From 3ef2866ef35e35383cd0b38cd80bb66ebf595f5a Mon Sep 17 00:00:00 2001 From: Dan Jaglowski Date: Wed, 1 Feb 2023 21:07:08 -0500 Subject: [PATCH] Rename pipelineSettings fields with Builder --- service/pipelines.go | 14 +++++++------- service/pipelines_test.go | 18 +++++++++--------- service/service.go | 14 +++++++------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/service/pipelines.go b/service/pipelines.go index 4659ad88a7a..edfcbf2d583 100644 --- a/service/pipelines.go +++ b/service/pipelines.go @@ -194,10 +194,10 @@ type pipelinesSettings struct { Telemetry component.TelemetrySettings BuildInfo component.BuildInfo - Receivers *receiver.Builder - Processors *processor.Builder - Exporters *exporter.Builder - Connectors *connector.Builder + ReceiverBuilder *receiver.Builder + ProcessorBuilder *processor.Builder + ExporterBuilder *exporter.Builder + ConnectorBuilder *connector.Builder // PipelineConfigs is a map of component.ID to PipelineConfig. PipelineConfigs map[component.ID]*PipelineConfig @@ -245,7 +245,7 @@ func buildPipelines(ctx context.Context, set pipelinesSettings) (pipelines, erro BuildInfo: set.BuildInfo, } cSet.TelemetrySettings.Logger = components.ExporterLogger(set.Telemetry.Logger, expID, pipelineID.Type()) - exp, err := buildExporter(ctx, cSet, set.Exporters, pipelineID) + exp, err := buildExporter(ctx, cSet, set.ExporterBuilder, pipelineID) if err != nil { return nil, err } @@ -279,7 +279,7 @@ func buildPipelines(ctx context.Context, set pipelinesSettings) (pipelines, erro BuildInfo: set.BuildInfo, } cSet.TelemetrySettings.Logger = components.ProcessorLogger(set.Telemetry.Logger, procID, pipelineID) - proc, err := buildProcessor(ctx, cSet, set.Processors, pipelineID, bp.lastConsumer) + proc, err := buildProcessor(ctx, cSet, set.ProcessorBuilder, pipelineID, bp.lastConsumer) if err != nil { return nil, err } @@ -336,7 +336,7 @@ func buildPipelines(ctx context.Context, set pipelinesSettings) (pipelines, erro BuildInfo: set.BuildInfo, } cSet.TelemetrySettings.Logger = components.ReceiverLogger(set.Telemetry.Logger, recvID, pipelineID.Type()) - recv, err := buildReceiver(ctx, cSet, set.Receivers, pipelineID, receiversConsumers[pipelineID.Type()][recvID]) + recv, err := buildReceiver(ctx, cSet, set.ReceiverBuilder, pipelineID, receiversConsumers[pipelineID.Type()][recvID]) if err != nil { return nil, err } diff --git a/service/pipelines_test.go b/service/pipelines_test.go index 5d6704a8dca..d1f47904e91 100644 --- a/service/pipelines_test.go +++ b/service/pipelines_test.go @@ -184,7 +184,7 @@ func TestBuildPipelines(t *testing.T) { pips, err := buildPipelines(context.Background(), pipelinesSettings{ Telemetry: componenttest.NewNopTelemetrySettings(), BuildInfo: component.NewDefaultBuildInfo(), - Receivers: receiver.NewBuilder( + ReceiverBuilder: receiver.NewBuilder( map[component.ID]component.Config{ component.NewID("examplereceiver"): testcomponents.ExampleReceiverFactory.CreateDefaultConfig(), component.NewIDWithName("examplereceiver", "1"): testcomponents.ExampleReceiverFactory.CreateDefaultConfig(), @@ -192,7 +192,7 @@ func TestBuildPipelines(t *testing.T) { map[component.Type]receiver.Factory{ testcomponents.ExampleReceiverFactory.Type(): testcomponents.ExampleReceiverFactory, }), - Processors: processor.NewBuilder( + ProcessorBuilder: processor.NewBuilder( map[component.ID]component.Config{ component.NewID("exampleprocessor"): testcomponents.ExampleProcessorFactory.CreateDefaultConfig(), component.NewIDWithName("exampleprocessor", "1"): testcomponents.ExampleProcessorFactory.CreateDefaultConfig(), @@ -200,7 +200,7 @@ func TestBuildPipelines(t *testing.T) { map[component.Type]processor.Factory{ testcomponents.ExampleProcessorFactory.Type(): testcomponents.ExampleProcessorFactory, }), - Exporters: exporter.NewBuilder( + ExporterBuilder: exporter.NewBuilder( map[component.ID]component.Config{ component.NewID("exampleexporter"): testcomponents.ExampleExporterFactory.CreateDefaultConfig(), component.NewIDWithName("exampleexporter", "1"): testcomponents.ExampleExporterFactory.CreateDefaultConfig(), @@ -579,19 +579,19 @@ func TestBuildErrors(t *testing.T) { set := pipelinesSettings{ Telemetry: componenttest.NewNopTelemetrySettings(), BuildInfo: component.NewDefaultBuildInfo(), - Receivers: receiver.NewBuilder( + ReceiverBuilder: receiver.NewBuilder( test.ReceiverConfigs, map[component.Type]receiver.Factory{ nopReceiverFactory.Type(): nopReceiverFactory, badReceiverFactory.Type(): badReceiverFactory, }), - Processors: processor.NewBuilder( + ProcessorBuilder: processor.NewBuilder( test.ProcessorConfigs, map[component.Type]processor.Factory{ nopProcessorFactory.Type(): nopProcessorFactory, badProcessorFactory.Type(): badProcessorFactory, }), - Exporters: exporter.NewBuilder( + ExporterBuilder: exporter.NewBuilder( test.ExporterConfigs, map[component.Type]exporter.Factory{ nopExporterFactory.Type(): nopExporterFactory, @@ -617,7 +617,7 @@ func TestFailToStartAndShutdown(t *testing.T) { set := pipelinesSettings{ Telemetry: componenttest.NewNopTelemetrySettings(), BuildInfo: component.NewDefaultBuildInfo(), - Receivers: receiver.NewBuilder( + ReceiverBuilder: receiver.NewBuilder( map[component.ID]component.Config{ component.NewID(nopReceiverFactory.Type()): nopReceiverFactory.CreateDefaultConfig(), component.NewID(errReceiverFactory.Type()): errReceiverFactory.CreateDefaultConfig(), @@ -626,7 +626,7 @@ func TestFailToStartAndShutdown(t *testing.T) { nopReceiverFactory.Type(): nopReceiverFactory, errReceiverFactory.Type(): errReceiverFactory, }), - Processors: processor.NewBuilder( + ProcessorBuilder: processor.NewBuilder( map[component.ID]component.Config{ component.NewID(nopProcessorFactory.Type()): nopProcessorFactory.CreateDefaultConfig(), component.NewID(errProcessorFactory.Type()): errProcessorFactory.CreateDefaultConfig(), @@ -635,7 +635,7 @@ func TestFailToStartAndShutdown(t *testing.T) { nopProcessorFactory.Type(): nopProcessorFactory, errProcessorFactory.Type(): errProcessorFactory, }), - Exporters: exporter.NewBuilder( + ExporterBuilder: exporter.NewBuilder( map[component.ID]component.Config{ component.NewID(nopExporterFactory.Type()): nopExporterFactory.CreateDefaultConfig(), component.NewID(errExporterFactory.Type()): errExporterFactory.CreateDefaultConfig(), diff --git a/service/service.go b/service/service.go index c63c8fff64a..5d96598a8e4 100644 --- a/service/service.go +++ b/service/service.go @@ -190,13 +190,13 @@ func (srv *Service) initExtensionsAndPipeline(ctx context.Context, set Settings, } pSet := pipelinesSettings{ - Telemetry: srv.telemetrySettings, - BuildInfo: srv.buildInfo, - Receivers: set.Receivers, - Processors: set.Processors, - Exporters: set.Exporters, - Connectors: set.Connectors, - PipelineConfigs: cfg.Pipelines, + Telemetry: srv.telemetrySettings, + BuildInfo: srv.buildInfo, + ReceiverBuilder: set.Receivers, + ProcessorBuilder: set.Processors, + ExporterBuilder: set.Exporters, + ConnectorBuilder: set.Connectors, + PipelineConfigs: cfg.Pipelines, } if sharedgate.ConnectorsFeatureGate.IsEnabled() {