From a930b6f3f982aba727e031f78cb7f9ccf3f0455b Mon Sep 17 00:00:00 2001 From: Patryk Matyjasek Date: Mon, 24 May 2021 11:27:09 +0200 Subject: [PATCH 1/2] Replace ProcessorCreateParams with ProcessorCreateSettings. Replace all dependencies in Processors. Signed-off-by: Patryk Matyjasek --- component/componenttest/nop_processor.go | 6 +-- component/componenttest/nop_processor_test.go | 6 +-- component/componenttest/shutdown_verifier.go | 2 +- component/processor.go | 16 +++--- component/processor_test.go | 6 +-- internal/testcomponents/example_processor.go | 6 +-- .../attributes_log_test.go | 12 ++--- .../attributes_trace_test.go | 12 ++--- processor/attributesprocessor/factory.go | 4 +- processor/attributesprocessor/factory_test.go | 22 ++++---- processor/batchprocessor/batch_processor.go | 16 +++--- .../batchprocessor/batch_processor_test.go | 52 +++++++++---------- processor/batchprocessor/factory.go | 12 ++--- processor/batchprocessor/factory_test.go | 8 +-- processor/filterprocessor/expr_test.go | 2 +- processor/filterprocessor/factory.go | 4 +- processor/filterprocessor/factory_test.go | 4 +- .../filterprocessor/filter_processor_test.go | 6 +-- processor/memorylimiter/factory.go | 12 ++--- processor/memorylimiter/factory_test.go | 12 ++--- .../probabilisticsamplerprocessor/factory.go | 2 +- .../factory_test.go | 4 +- processor/processorhelper/factory.go | 24 ++++----- processor/processorhelper/factory_test.go | 18 +++---- processor/resourceprocessor/factory.go | 6 +-- processor/resourceprocessor/factory_test.go | 12 ++--- .../resource_processor_test.go | 12 ++--- processor/spanprocessor/factory.go | 2 +- processor/spanprocessor/factory_test.go | 6 +-- processor/spanprocessor/span_test.go | 22 ++++---- .../default_processors_test.go | 20 +++---- service/internal/builder/pipelines_builder.go | 8 +-- 32 files changed, 178 insertions(+), 178 deletions(-) diff --git a/component/componenttest/nop_processor.go b/component/componenttest/nop_processor.go index f6c1bacaa1d..4b744b373e1 100644 --- a/component/componenttest/nop_processor.go +++ b/component/componenttest/nop_processor.go @@ -55,7 +55,7 @@ func (f *nopProcessorFactory) CreateDefaultConfig() config.Processor { // CreateTracesProcessor implements component.ProcessorFactory interface. func (f *nopProcessorFactory) CreateTracesProcessor( _ context.Context, - _ component.ProcessorCreateParams, + _ component.ProcessorCreateSettings, _ config.Processor, _ consumer.Traces, ) (component.TracesProcessor, error) { @@ -65,7 +65,7 @@ func (f *nopProcessorFactory) CreateTracesProcessor( // CreateMetricsProcessor implements component.ProcessorFactory interface. func (f *nopProcessorFactory) CreateMetricsProcessor( _ context.Context, - _ component.ProcessorCreateParams, + _ component.ProcessorCreateSettings, _ config.Processor, _ consumer.Metrics, ) (component.MetricsProcessor, error) { @@ -75,7 +75,7 @@ func (f *nopProcessorFactory) CreateMetricsProcessor( // CreateLogsProcessor implements component.ProcessorFactory interface. func (f *nopProcessorFactory) CreateLogsProcessor( _ context.Context, - _ component.ProcessorCreateParams, + _ component.ProcessorCreateSettings, _ config.Processor, _ consumer.Logs, ) (component.LogsProcessor, error) { diff --git a/component/componenttest/nop_processor_test.go b/component/componenttest/nop_processor_test.go index 92306caf32d..02e79c65ae5 100644 --- a/component/componenttest/nop_processor_test.go +++ b/component/componenttest/nop_processor_test.go @@ -35,21 +35,21 @@ func TestNewNopProcessorFactory(t *testing.T) { cfg := factory.CreateDefaultConfig() assert.Equal(t, &nopProcessorConfig{ProcessorSettings: config.NewProcessorSettings(config.NewID("nop"))}, cfg) - traces, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + traces, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) require.NoError(t, err) assert.Equal(t, consumer.Capabilities{MutatesData: false}, traces.Capabilities()) assert.NoError(t, traces.Start(context.Background(), NewNopHost())) assert.NoError(t, traces.ConsumeTraces(context.Background(), pdata.NewTraces())) assert.NoError(t, traces.Shutdown(context.Background())) - metrics, err := factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + metrics, err := factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) require.NoError(t, err) assert.Equal(t, consumer.Capabilities{MutatesData: false}, metrics.Capabilities()) assert.NoError(t, metrics.Start(context.Background(), NewNopHost())) assert.NoError(t, metrics.ConsumeMetrics(context.Background(), pdata.NewMetrics())) assert.NoError(t, metrics.Shutdown(context.Background())) - logs, err := factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + logs, err := factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) require.NoError(t, err) assert.Equal(t, consumer.Capabilities{MutatesData: false}, logs.Capabilities()) assert.NoError(t, logs.Start(context.Background(), NewNopHost())) diff --git a/component/componenttest/shutdown_verifier.go b/component/componenttest/shutdown_verifier.go index 8979ed0d1ad..490010e51b6 100644 --- a/component/componenttest/shutdown_verifier.go +++ b/component/componenttest/shutdown_verifier.go @@ -34,7 +34,7 @@ func verifyTracesProcessorDoesntProduceAfterShutdown(t *testing.T, factory compo nextSink := new(consumertest.TracesSink) processor, err := factory.CreateTracesProcessor( context.Background(), - component.ProcessorCreateParams{Logger: zap.NewNop()}, + component.ProcessorCreateSettings{Logger: zap.NewNop()}, cfg, nextSink, ) diff --git a/component/processor.go b/component/processor.go index 70b661beda1..86d2d2f019f 100644 --- a/component/processor.go +++ b/component/processor.go @@ -48,8 +48,8 @@ type LogsProcessor interface { consumer.Logs } -// ProcessorCreateParams is passed to Create* functions in ProcessorFactory. -type ProcessorCreateParams struct { +// ProcessorCreateSettings is passed to Create* functions in ProcessorFactory. +type ProcessorCreateSettings struct { // Logger that the factory can use during creation and can pass to the created // component to be used later as well. Logger *zap.Logger @@ -80,7 +80,7 @@ type ProcessorFactory interface { // an error will be returned instead. CreateTracesProcessor( ctx context.Context, - params ProcessorCreateParams, + set ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Traces, ) (TracesProcessor, error) @@ -90,7 +90,7 @@ type ProcessorFactory interface { // an error will be returned instead. CreateMetricsProcessor( ctx context.Context, - params ProcessorCreateParams, + set ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Metrics, ) (MetricsProcessor, error) @@ -100,7 +100,7 @@ type ProcessorFactory interface { // an error will be returned instead. CreateLogsProcessor( ctx context.Context, - params ProcessorCreateParams, + set ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Logs, ) (LogsProcessor, error) @@ -125,17 +125,17 @@ func (b BaseProcessorFactory) CreateDefaultConfig() config.Processor { } // CreateTracesProcessor default implemented as not supported data type. -func (b BaseProcessorFactory) CreateTracesProcessor(context.Context, ProcessorCreateParams, config.Processor, consumer.Traces) (TracesProcessor, error) { +func (b BaseProcessorFactory) CreateTracesProcessor(context.Context, ProcessorCreateSettings, config.Processor, consumer.Traces) (TracesProcessor, error) { return nil, componenterror.ErrDataTypeIsNotSupported } // CreateMetricsProcessor default implemented as not supported data type. -func (b BaseProcessorFactory) CreateMetricsProcessor(context.Context, ProcessorCreateParams, config.Processor, consumer.Metrics) (MetricsProcessor, error) { +func (b BaseProcessorFactory) CreateMetricsProcessor(context.Context, ProcessorCreateSettings, config.Processor, consumer.Metrics) (MetricsProcessor, error) { return nil, componenterror.ErrDataTypeIsNotSupported } // CreateLogsProcessor default implemented as not supported data type. -func (b BaseProcessorFactory) CreateLogsProcessor(context.Context, ProcessorCreateParams, config.Processor, consumer.Logs) (LogsProcessor, error) { +func (b BaseProcessorFactory) CreateLogsProcessor(context.Context, ProcessorCreateSettings, config.Processor, consumer.Logs) (LogsProcessor, error) { return nil, componenterror.ErrDataTypeIsNotSupported } diff --git a/component/processor_test.go b/component/processor_test.go index 65c378a92f5..e16cc3665f1 100644 --- a/component/processor_test.go +++ b/component/processor_test.go @@ -86,10 +86,10 @@ func TestBaseProcessorFactory(t *testing.T) { }) assert.NotPanics(t, bpf.unexportedProcessor) defaultCfg := config.NewProcessorSettings(config.NewID("nop")) - _, err := bpf.CreateTracesProcessor(context.Background(), ProcessorCreateParams{}, &defaultCfg, consumertest.NewNop()) + _, err := bpf.CreateTracesProcessor(context.Background(), ProcessorCreateSettings{}, &defaultCfg, consumertest.NewNop()) assert.ErrorIs(t, err, componenterror.ErrDataTypeIsNotSupported) - _, err = bpf.CreateMetricsProcessor(context.Background(), ProcessorCreateParams{}, &defaultCfg, consumertest.NewNop()) + _, err = bpf.CreateMetricsProcessor(context.Background(), ProcessorCreateSettings{}, &defaultCfg, consumertest.NewNop()) assert.ErrorIs(t, err, componenterror.ErrDataTypeIsNotSupported) - _, err = bpf.CreateLogsProcessor(context.Background(), ProcessorCreateParams{}, &defaultCfg, consumertest.NewNop()) + _, err = bpf.CreateLogsProcessor(context.Background(), ProcessorCreateSettings{}, &defaultCfg, consumertest.NewNop()) assert.ErrorIs(t, err, componenterror.ErrDataTypeIsNotSupported) } diff --git a/internal/testcomponents/example_processor.go b/internal/testcomponents/example_processor.go index 9d9227c91f7..788b14b6cad 100644 --- a/internal/testcomponents/example_processor.go +++ b/internal/testcomponents/example_processor.go @@ -52,15 +52,15 @@ func createDefaultConfig() config.Processor { } } -func createTracesProcessor(_ context.Context, _ component.ProcessorCreateParams, _ config.Processor, nextConsumer consumer.Traces) (component.TracesProcessor, error) { +func createTracesProcessor(_ context.Context, _ component.ProcessorCreateSettings, _ config.Processor, nextConsumer consumer.Traces) (component.TracesProcessor, error) { return &exampleProcessor{Traces: nextConsumer}, nil } -func createMetricsProcessor(_ context.Context, _ component.ProcessorCreateParams, _ config.Processor, nextConsumer consumer.Metrics) (component.MetricsProcessor, error) { +func createMetricsProcessor(_ context.Context, _ component.ProcessorCreateSettings, _ config.Processor, nextConsumer consumer.Metrics) (component.MetricsProcessor, error) { return &exampleProcessor{Metrics: nextConsumer}, nil } -func createLogsProcessor(_ context.Context, _ component.ProcessorCreateParams, _ config.Processor, nextConsumer consumer.Logs) (component.LogsProcessor, error) { +func createLogsProcessor(_ context.Context, _ component.ProcessorCreateSettings, _ config.Processor, nextConsumer consumer.Logs) (component.LogsProcessor, error) { return &exampleProcessor{Logs: nextConsumer}, nil } diff --git a/processor/attributesprocessor/attributes_log_test.go b/processor/attributesprocessor/attributes_log_test.go index ea6b2b7977c..c43322ed375 100644 --- a/processor/attributesprocessor/attributes_log_test.go +++ b/processor/attributesprocessor/attributes_log_test.go @@ -106,7 +106,7 @@ func TestLogProcessor_NilEmptyData(t *testing.T) { } tp, err := factory.CreateLogsProcessor( - context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, oCfg, consumertest.NewNop()) + context.Background(), component.ProcessorCreateSettings{Logger: zap.NewNop()}, oCfg, consumertest.NewNop()) require.Nil(t, err) require.NotNil(t, tp) for i := range testCases { @@ -169,7 +169,7 @@ func TestAttributes_FilterLogs(t *testing.T) { }, Config: *createConfig(filterset.Strict), } - tp, err := factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + tp, err := factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) require.Nil(t, err) require.NotNil(t, tp) @@ -232,7 +232,7 @@ func TestAttributes_FilterLogsByNameStrict(t *testing.T) { LogNames: []string{"dont_apply"}, Config: *createConfig(filterset.Strict), } - tp, err := factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + tp, err := factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) require.Nil(t, err) require.NotNil(t, tp) @@ -295,7 +295,7 @@ func TestAttributes_FilterLogsByNameRegexp(t *testing.T) { LogNames: []string{".*dont_apply$"}, Config: *createConfig(filterset.Regexp), } - tp, err := factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + tp, err := factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) require.Nil(t, err) require.NotNil(t, tp) @@ -354,7 +354,7 @@ func TestLogAttributes_Hash(t *testing.T) { {Key: "user.authenticated", Action: processorhelper.HASH}, } - tp, err := factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + tp, err := factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) require.Nil(t, err) require.NotNil(t, tp) @@ -398,7 +398,7 @@ func BenchmarkAttributes_FilterLogsByName(b *testing.B) { oCfg.Include = &filterconfig.MatchProperties{ LogNames: []string{"^apply.*"}, } - tp, err := factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + tp, err := factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) require.Nil(b, err) require.NotNil(b, tp) diff --git a/processor/attributesprocessor/attributes_trace_test.go b/processor/attributesprocessor/attributes_trace_test.go index 7665b07f897..0321880e569 100644 --- a/processor/attributesprocessor/attributes_trace_test.go +++ b/processor/attributesprocessor/attributes_trace_test.go @@ -116,7 +116,7 @@ func TestSpanProcessor_NilEmptyData(t *testing.T) { {Key: "attribute1", Action: processorhelper.DELETE}, } - tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, oCfg, consumertest.NewNop()) + tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{Logger: zap.NewNop()}, oCfg, consumertest.NewNop()) require.Nil(t, err) require.NotNil(t, tp) for i := range testCases { @@ -183,7 +183,7 @@ func TestAttributes_FilterSpans(t *testing.T) { }, Config: *createConfig(filterset.Strict), } - tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) require.Nil(t, err) require.NotNil(t, tp) @@ -251,7 +251,7 @@ func TestAttributes_FilterSpansByNameStrict(t *testing.T) { SpanNames: []string{"dont_apply"}, Config: *createConfig(filterset.Strict), } - tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) require.Nil(t, err) require.NotNil(t, tp) @@ -319,7 +319,7 @@ func TestAttributes_FilterSpansByNameRegexp(t *testing.T) { SpanNames: []string{".*dont_apply$"}, Config: *createConfig(filterset.Regexp), } - tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) require.Nil(t, err) require.NotNil(t, tp) @@ -378,7 +378,7 @@ func TestAttributes_Hash(t *testing.T) { {Key: "user.authenticated", Action: processorhelper.HASH}, } - tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) require.Nil(t, err) require.NotNil(t, tp) @@ -422,7 +422,7 @@ func BenchmarkAttributes_FilterSpansByName(b *testing.B) { oCfg.Include = &filterconfig.MatchProperties{ SpanNames: []string{"^apply.*"}, } - tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) require.Nil(b, err) require.NotNil(b, tp) diff --git a/processor/attributesprocessor/factory.go b/processor/attributesprocessor/factory.go index ef3c605a854..ef4aa835fc1 100644 --- a/processor/attributesprocessor/factory.go +++ b/processor/attributesprocessor/factory.go @@ -51,7 +51,7 @@ func createDefaultConfig() config.Processor { func createTracesProcessor( _ context.Context, - _ component.ProcessorCreateParams, + _ component.ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Traces, ) (component.TracesProcessor, error) { @@ -81,7 +81,7 @@ func createTracesProcessor( func createLogProcessor( _ context.Context, - _ component.ProcessorCreateParams, + _ component.ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Logs, ) (component.LogsProcessor, error) { diff --git a/processor/attributesprocessor/factory_test.go b/processor/attributesprocessor/factory_test.go index bce964ffe8a..ec435653084 100644 --- a/processor/attributesprocessor/factory_test.go +++ b/processor/attributesprocessor/factory_test.go @@ -46,7 +46,7 @@ func TestFactory_CreateDefaultConfig(t *testing.T) { func TestFactoryCreateTracesProcessor_EmptyActions(t *testing.T) { factory := NewFactory() cfg := factory.CreateDefaultConfig() - ap, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + ap, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) assert.Error(t, err) assert.Nil(t, ap) } @@ -59,7 +59,7 @@ func TestFactoryCreateTracesProcessor_InvalidActions(t *testing.T) { oCfg.Actions = []processorhelper.ActionKeyValue{ {Key: "", Value: 123, Action: processorhelper.UPSERT}, } - ap, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + ap, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) assert.Error(t, err) assert.Nil(t, ap) } @@ -72,18 +72,18 @@ func TestFactoryCreateTracesProcessor(t *testing.T) { {Key: "a key", Action: processorhelper.DELETE}, } - tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) assert.NotNil(t, tp) assert.NoError(t, err) - tp, err = factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, nil) + tp, err = factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, nil) assert.Nil(t, tp) assert.Error(t, err) oCfg.Actions = []processorhelper.ActionKeyValue{ {Action: processorhelper.DELETE}, } - tp, err = factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + tp, err = factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) assert.Nil(t, tp) assert.Error(t, err) } @@ -92,7 +92,7 @@ func TestFactory_CreateMetricsProcessor(t *testing.T) { factory := NewFactory() cfg := factory.CreateDefaultConfig() - mp, err := factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, nil) + mp, err := factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, nil) require.Nil(t, mp) assert.Equal(t, err, componenterror.ErrDataTypeIsNotSupported) } @@ -100,7 +100,7 @@ func TestFactory_CreateMetricsProcessor(t *testing.T) { func TestFactoryCreateLogsProcessor_EmptyActions(t *testing.T) { factory := NewFactory() cfg := factory.CreateDefaultConfig() - ap, err := factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + ap, err := factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) assert.Error(t, err) assert.Nil(t, ap) } @@ -113,7 +113,7 @@ func TestFactoryCreateLogsProcessor_InvalidActions(t *testing.T) { oCfg.Actions = []processorhelper.ActionKeyValue{ {Key: "", Value: 123, Action: processorhelper.UPSERT}, } - ap, err := factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + ap, err := factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) assert.Error(t, err) assert.Nil(t, ap) } @@ -127,12 +127,12 @@ func TestFactoryCreateLogsProcessor(t *testing.T) { } tp, err := factory.CreateLogsProcessor( - context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) assert.NotNil(t, tp) assert.NoError(t, err) tp, err = factory.CreateLogsProcessor( - context.Background(), component.ProcessorCreateParams{}, cfg, nil) + context.Background(), component.ProcessorCreateSettings{}, cfg, nil) assert.Nil(t, tp) assert.Error(t, err) @@ -140,7 +140,7 @@ func TestFactoryCreateLogsProcessor(t *testing.T) { {Action: processorhelper.DELETE}, } tp, err = factory.CreateLogsProcessor( - context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) assert.Nil(t, tp) assert.Error(t, err) } diff --git a/processor/batchprocessor/batch_processor.go b/processor/batchprocessor/batch_processor.go index 91d40f6e83b..eccca66fb7f 100644 --- a/processor/batchprocessor/batch_processor.go +++ b/processor/batchprocessor/batch_processor.go @@ -73,13 +73,13 @@ var _ consumer.Traces = (*batchProcessor)(nil) var _ consumer.Metrics = (*batchProcessor)(nil) var _ consumer.Logs = (*batchProcessor)(nil) -func newBatchProcessor(params component.ProcessorCreateParams, cfg *Config, batch batch, telemetryLevel configtelemetry.Level) (*batchProcessor, error) { +func newBatchProcessor(set component.ProcessorCreateSettings, cfg *Config, batch batch, telemetryLevel configtelemetry.Level) (*batchProcessor, error) { exportCtx, err := tag.New(context.Background(), tag.Insert(processorTagKey, cfg.ID().String())) if err != nil { return nil, err } return &batchProcessor{ - logger: params.Logger, + logger: set.Logger, exportCtx: exportCtx, telemetryLevel: telemetryLevel, @@ -205,18 +205,18 @@ func (bp *batchProcessor) ConsumeLogs(_ context.Context, ld pdata.Logs) error { } // newBatchTracesProcessor creates a new batch processor that batches traces by size or with timeout -func newBatchTracesProcessor(params component.ProcessorCreateParams, next consumer.Traces, cfg *Config, telemetryLevel configtelemetry.Level) (*batchProcessor, error) { - return newBatchProcessor(params, cfg, newBatchTraces(next), telemetryLevel) +func newBatchTracesProcessor(set component.ProcessorCreateSettings, next consumer.Traces, cfg *Config, telemetryLevel configtelemetry.Level) (*batchProcessor, error) { + return newBatchProcessor(set, cfg, newBatchTraces(next), telemetryLevel) } // newBatchMetricsProcessor creates a new batch processor that batches metrics by size or with timeout -func newBatchMetricsProcessor(params component.ProcessorCreateParams, next consumer.Metrics, cfg *Config, telemetryLevel configtelemetry.Level) (*batchProcessor, error) { - return newBatchProcessor(params, cfg, newBatchMetrics(next), telemetryLevel) +func newBatchMetricsProcessor(set component.ProcessorCreateSettings, next consumer.Metrics, cfg *Config, telemetryLevel configtelemetry.Level) (*batchProcessor, error) { + return newBatchProcessor(set, cfg, newBatchMetrics(next), telemetryLevel) } // newBatchLogsProcessor creates a new batch processor that batches logs by size or with timeout -func newBatchLogsProcessor(params component.ProcessorCreateParams, next consumer.Logs, cfg *Config, telemetryLevel configtelemetry.Level) (*batchProcessor, error) { - return newBatchProcessor(params, cfg, newBatchLogs(next), telemetryLevel) +func newBatchLogsProcessor(set component.ProcessorCreateSettings, next consumer.Logs, cfg *Config, telemetryLevel configtelemetry.Level) (*batchProcessor, error) { + return newBatchProcessor(set, cfg, newBatchLogs(next), telemetryLevel) } type batchTraces struct { diff --git a/processor/batchprocessor/batch_processor_test.go b/processor/batchprocessor/batch_processor_test.go index c6a4cf8f6d2..d8285ada3c8 100644 --- a/processor/batchprocessor/batch_processor_test.go +++ b/processor/batchprocessor/batch_processor_test.go @@ -38,8 +38,8 @@ func TestBatchProcessorSpansDelivered(t *testing.T) { sink := new(consumertest.TracesSink) cfg := createDefaultConfig().(*Config) cfg.SendBatchSize = 128 - creationParams := component.ProcessorCreateParams{Logger: zap.NewNop()} - batcher, err := newBatchTracesProcessor(creationParams, sink, cfg, configtelemetry.LevelDetailed) + creationSet := component.ProcessorCreateSettings{Logger: zap.NewNop()} + batcher, err := newBatchTracesProcessor(creationSet, sink, cfg, configtelemetry.LevelDetailed) require.NoError(t, err) require.NoError(t, batcher.Start(context.Background(), componenttest.NewNopHost())) @@ -80,8 +80,8 @@ func TestBatchProcessorSpansDeliveredEnforceBatchSize(t *testing.T) { cfg := createDefaultConfig().(*Config) cfg.SendBatchSize = 128 cfg.SendBatchMaxSize = 130 - creationParams := component.ProcessorCreateParams{Logger: zap.NewNop()} - batcher, err := newBatchTracesProcessor(creationParams, sink, cfg, configtelemetry.LevelBasic) + creationSet := component.ProcessorCreateSettings{Logger: zap.NewNop()} + batcher, err := newBatchTracesProcessor(creationSet, sink, cfg, configtelemetry.LevelBasic) require.NoError(t, err) require.NoError(t, batcher.Start(context.Background(), componenttest.NewNopHost())) @@ -128,8 +128,8 @@ func TestBatchProcessorSentBySize(t *testing.T) { sendBatchSize := 20 cfg.SendBatchSize = uint32(sendBatchSize) cfg.Timeout = 500 * time.Millisecond - creationParams := component.ProcessorCreateParams{Logger: zap.NewNop()} - batcher, err := newBatchTracesProcessor(creationParams, sink, cfg, configtelemetry.LevelDetailed) + creationSet := component.ProcessorCreateSettings{Logger: zap.NewNop()} + batcher, err := newBatchTracesProcessor(creationSet, sink, cfg, configtelemetry.LevelDetailed) require.NoError(t, err) require.NoError(t, batcher.Start(context.Background(), componenttest.NewNopHost())) @@ -186,13 +186,13 @@ func TestBatchProcessorSentByTimeout(t *testing.T) { sendBatchSize := 100 cfg.SendBatchSize = uint32(sendBatchSize) cfg.Timeout = 100 * time.Millisecond - creationParams := component.ProcessorCreateParams{Logger: zap.NewNop()} + creationSet := component.ProcessorCreateSettings{Logger: zap.NewNop()} requestCount := 5 spansPerRequest := 10 start := time.Now() - batcher, err := newBatchTracesProcessor(creationParams, sink, cfg, configtelemetry.LevelDetailed) + batcher, err := newBatchTracesProcessor(creationSet, sink, cfg, configtelemetry.LevelDetailed) require.NoError(t, err) require.NoError(t, batcher.Start(context.Background(), componenttest.NewNopHost())) @@ -238,8 +238,8 @@ func TestBatchProcessorTraceSendWhenClosing(t *testing.T) { } sink := new(consumertest.TracesSink) - creationParams := component.ProcessorCreateParams{Logger: zap.NewNop()} - batcher, err := newBatchTracesProcessor(creationParams, sink, &cfg, configtelemetry.LevelDetailed) + creationSet := component.ProcessorCreateSettings{Logger: zap.NewNop()} + batcher, err := newBatchTracesProcessor(creationSet, sink, &cfg, configtelemetry.LevelDetailed) require.NoError(t, err) require.NoError(t, batcher.Start(context.Background(), componenttest.NewNopHost())) @@ -269,8 +269,8 @@ func TestBatchMetricProcessor_ReceivingData(t *testing.T) { metricsPerRequest := 5 sink := new(consumertest.MetricsSink) - createParams := component.ProcessorCreateParams{Logger: zap.NewNop()} - batcher, err := newBatchMetricsProcessor(createParams, sink, &cfg, configtelemetry.LevelDetailed) + creationSet := component.ProcessorCreateSettings{Logger: zap.NewNop()} + batcher, err := newBatchMetricsProcessor(creationSet, sink, &cfg, configtelemetry.LevelDetailed) require.NoError(t, err) require.NoError(t, batcher.Start(context.Background(), componenttest.NewNopHost())) @@ -322,8 +322,8 @@ func TestBatchMetricProcessor_BatchSize(t *testing.T) { metricsPerRequest := 5 sink := new(consumertest.MetricsSink) - createParams := component.ProcessorCreateParams{Logger: zap.NewNop()} - batcher, err := newBatchMetricsProcessor(createParams, sink, &cfg, configtelemetry.LevelDetailed) + creationSet := component.ProcessorCreateSettings{Logger: zap.NewNop()} + batcher, err := newBatchMetricsProcessor(creationSet, sink, &cfg, configtelemetry.LevelDetailed) require.NoError(t, err) require.NoError(t, batcher.Start(context.Background(), componenttest.NewNopHost())) @@ -379,8 +379,8 @@ func TestBatchMetricsProcessor_Timeout(t *testing.T) { metricsPerRequest := 10 sink := new(consumertest.MetricsSink) - createParams := component.ProcessorCreateParams{Logger: zap.NewNop()} - batcher, err := newBatchMetricsProcessor(createParams, sink, &cfg, configtelemetry.LevelDetailed) + creationSet := component.ProcessorCreateSettings{Logger: zap.NewNop()} + batcher, err := newBatchMetricsProcessor(creationSet, sink, &cfg, configtelemetry.LevelDetailed) require.NoError(t, err) require.NoError(t, batcher.Start(context.Background(), componenttest.NewNopHost())) @@ -428,8 +428,8 @@ func TestBatchMetricProcessor_Shutdown(t *testing.T) { metricsPerRequest := 10 sink := new(consumertest.MetricsSink) - createParams := component.ProcessorCreateParams{Logger: zap.NewNop()} - batcher, err := newBatchMetricsProcessor(createParams, sink, &cfg, configtelemetry.LevelDetailed) + creationSet := component.ProcessorCreateSettings{Logger: zap.NewNop()} + batcher, err := newBatchMetricsProcessor(creationSet, sink, &cfg, configtelemetry.LevelDetailed) require.NoError(t, err) require.NoError(t, batcher.Start(context.Background(), componenttest.NewNopHost())) @@ -515,8 +515,8 @@ func TestBatchLogProcessor_ReceivingData(t *testing.T) { logsPerRequest := 5 sink := new(consumertest.LogsSink) - createParams := component.ProcessorCreateParams{Logger: zap.NewNop()} - batcher, err := newBatchLogsProcessor(createParams, sink, &cfg, configtelemetry.LevelDetailed) + creationSet := component.ProcessorCreateSettings{Logger: zap.NewNop()} + batcher, err := newBatchLogsProcessor(creationSet, sink, &cfg, configtelemetry.LevelDetailed) require.NoError(t, err) require.NoError(t, batcher.Start(context.Background(), componenttest.NewNopHost())) @@ -568,8 +568,8 @@ func TestBatchLogProcessor_BatchSize(t *testing.T) { logsPerRequest := 5 sink := new(consumertest.LogsSink) - createParams := component.ProcessorCreateParams{Logger: zap.NewNop()} - batcher, err := newBatchLogsProcessor(createParams, sink, &cfg, configtelemetry.LevelDetailed) + creationSet := component.ProcessorCreateSettings{Logger: zap.NewNop()} + batcher, err := newBatchLogsProcessor(creationSet, sink, &cfg, configtelemetry.LevelDetailed) require.NoError(t, err) require.NoError(t, batcher.Start(context.Background(), componenttest.NewNopHost())) @@ -625,8 +625,8 @@ func TestBatchLogsProcessor_Timeout(t *testing.T) { logsPerRequest := 10 sink := new(consumertest.LogsSink) - createParams := component.ProcessorCreateParams{Logger: zap.NewNop()} - batcher, err := newBatchLogsProcessor(createParams, sink, &cfg, configtelemetry.LevelDetailed) + creationSet := component.ProcessorCreateSettings{Logger: zap.NewNop()} + batcher, err := newBatchLogsProcessor(creationSet, sink, &cfg, configtelemetry.LevelDetailed) require.NoError(t, err) require.NoError(t, batcher.Start(context.Background(), componenttest.NewNopHost())) @@ -674,8 +674,8 @@ func TestBatchLogProcessor_Shutdown(t *testing.T) { logsPerRequest := 10 sink := new(consumertest.LogsSink) - createParams := component.ProcessorCreateParams{Logger: zap.NewNop()} - batcher, err := newBatchLogsProcessor(createParams, sink, &cfg, configtelemetry.LevelDetailed) + creationSet := component.ProcessorCreateSettings{Logger: zap.NewNop()} + batcher, err := newBatchLogsProcessor(creationSet, sink, &cfg, configtelemetry.LevelDetailed) require.NoError(t, err) require.NoError(t, batcher.Start(context.Background(), componenttest.NewNopHost())) diff --git a/processor/batchprocessor/factory.go b/processor/batchprocessor/factory.go index 82e4b45f67a..42cf1d858bf 100644 --- a/processor/batchprocessor/factory.go +++ b/processor/batchprocessor/factory.go @@ -53,30 +53,30 @@ func createDefaultConfig() config.Processor { func createTracesProcessor( _ context.Context, - params component.ProcessorCreateParams, + set component.ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Traces, ) (component.TracesProcessor, error) { level := configtelemetry.GetMetricsLevelFlagValue() - return newBatchTracesProcessor(params, nextConsumer, cfg.(*Config), level) + return newBatchTracesProcessor(set, nextConsumer, cfg.(*Config), level) } func createMetricsProcessor( _ context.Context, - params component.ProcessorCreateParams, + set component.ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Metrics, ) (component.MetricsProcessor, error) { level := configtelemetry.GetMetricsLevelFlagValue() - return newBatchMetricsProcessor(params, nextConsumer, cfg.(*Config), level) + return newBatchMetricsProcessor(set, nextConsumer, cfg.(*Config), level) } func createLogsProcessor( _ context.Context, - params component.ProcessorCreateParams, + set component.ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Logs, ) (component.LogsProcessor, error) { level := configtelemetry.GetMetricsLevelFlagValue() - return newBatchLogsProcessor(params, nextConsumer, cfg.(*Config), level) + return newBatchLogsProcessor(set, nextConsumer, cfg.(*Config), level) } diff --git a/processor/batchprocessor/factory_test.go b/processor/batchprocessor/factory_test.go index 28d36d15d21..d36fbca3801 100644 --- a/processor/batchprocessor/factory_test.go +++ b/processor/batchprocessor/factory_test.go @@ -37,16 +37,16 @@ func TestCreateProcessor(t *testing.T) { factory := NewFactory() cfg := factory.CreateDefaultConfig() - creationParams := component.ProcessorCreateParams{Logger: zap.NewNop()} - tp, err := factory.CreateTracesProcessor(context.Background(), creationParams, cfg, nil) + creationSet := component.ProcessorCreateSettings{Logger: zap.NewNop()} + tp, err := factory.CreateTracesProcessor(context.Background(), creationSet, cfg, nil) assert.NotNil(t, tp) assert.NoError(t, err, "cannot create trace processor") - mp, err := factory.CreateMetricsProcessor(context.Background(), creationParams, cfg, nil) + mp, err := factory.CreateMetricsProcessor(context.Background(), creationSet, cfg, nil) assert.NotNil(t, mp) assert.NoError(t, err, "cannot create metric processor") - lp, err := factory.CreateLogsProcessor(context.Background(), creationParams, cfg, nil) + lp, err := factory.CreateLogsProcessor(context.Background(), creationSet, cfg, nil) assert.NotNil(t, lp) assert.NoError(t, err, "cannot create logs processor") } diff --git a/processor/filterprocessor/expr_test.go b/processor/filterprocessor/expr_test.go index 7a329bb2b56..cc0eb4fc964 100644 --- a/processor/filterprocessor/expr_test.go +++ b/processor/filterprocessor/expr_test.go @@ -156,7 +156,7 @@ func testProcessor(t *testing.T, include []string, exclude []string) (component. core, logs := observer.New(zapcore.WarnLevel) proc, err := factory.CreateMetricsProcessor( ctx, - component.ProcessorCreateParams{ + component.ProcessorCreateSettings{ Logger: zap.New(core), }, cfg, diff --git a/processor/filterprocessor/factory.go b/processor/filterprocessor/factory.go index 0a1d07b4a85..ccf44da4972 100644 --- a/processor/filterprocessor/factory.go +++ b/processor/filterprocessor/factory.go @@ -46,11 +46,11 @@ func createDefaultConfig() config.Processor { func createMetricsProcessor( _ context.Context, - params component.ProcessorCreateParams, + set component.ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Metrics, ) (component.MetricsProcessor, error) { - fp, err := newFilterMetricProcessor(params.Logger, cfg.(*Config)) + fp, err := newFilterMetricProcessor(set.Logger, cfg.(*Config)) if err != nil { return nil, err } diff --git a/processor/filterprocessor/factory_test.go b/processor/filterprocessor/factory_test.go index 5cf12a6d236..3f44b67db78 100644 --- a/processor/filterprocessor/factory_test.go +++ b/processor/filterprocessor/factory_test.go @@ -77,12 +77,12 @@ func TestCreateProcessors(t *testing.T) { t.Run(fmt.Sprintf("%s/%s", test.configName, name), func(t *testing.T) { factory := NewFactory() - tp, tErr := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, cfg, consumertest.NewNop()) + tp, tErr := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{Logger: zap.NewNop()}, cfg, consumertest.NewNop()) // Not implemented error assert.NotNil(t, tErr) assert.Nil(t, tp) - mp, mErr := factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, cfg, consumertest.NewNop()) + mp, mErr := factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateSettings{Logger: zap.NewNop()}, cfg, consumertest.NewNop()) assert.Equal(t, test.succeed, mp != nil) assert.Equal(t, test.succeed, mErr == nil) }) diff --git a/processor/filterprocessor/filter_processor_test.go b/processor/filterprocessor/filter_processor_test.go index 28ef0d08fb7..850ad6a55f0 100644 --- a/processor/filterprocessor/filter_processor_test.go +++ b/processor/filterprocessor/filter_processor_test.go @@ -309,7 +309,7 @@ func TestFilterMetricProcessor(t *testing.T) { factory := NewFactory() fmp, err := factory.CreateMetricsProcessor( context.Background(), - component.ProcessorCreateParams{ + component.ProcessorCreateSettings{ Logger: zap.NewNop(), }, cfg, @@ -400,7 +400,7 @@ func benchmarkFilter(b *testing.B, mp *filtermetric.MatchProperties) { ctx := context.Background() proc, _ := factory.CreateMetricsProcessor( ctx, - component.ProcessorCreateParams{Logger: zap.NewNop()}, + component.ProcessorCreateSettings{Logger: zap.NewNop()}, cfg, consumertest.NewNop(), ) @@ -477,7 +477,7 @@ func requireNotPanics(t *testing.T, metrics pdata.Metrics) { ctx := context.Background() proc, _ := factory.CreateMetricsProcessor( ctx, - component.ProcessorCreateParams{ + component.ProcessorCreateSettings{ Logger: zap.NewNop(), }, cfg, diff --git a/processor/memorylimiter/factory.go b/processor/memorylimiter/factory.go index c240a9fc683..934d50a62e9 100644 --- a/processor/memorylimiter/factory.go +++ b/processor/memorylimiter/factory.go @@ -50,11 +50,11 @@ func createDefaultConfig() config.Processor { func createTracesProcessor( _ context.Context, - params component.ProcessorCreateParams, + set component.ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Traces, ) (component.TracesProcessor, error) { - ml, err := newMemoryLimiter(params.Logger, cfg.(*Config)) + ml, err := newMemoryLimiter(set.Logger, cfg.(*Config)) if err != nil { return nil, err } @@ -68,11 +68,11 @@ func createTracesProcessor( func createMetricsProcessor( _ context.Context, - params component.ProcessorCreateParams, + set component.ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Metrics, ) (component.MetricsProcessor, error) { - ml, err := newMemoryLimiter(params.Logger, cfg.(*Config)) + ml, err := newMemoryLimiter(set.Logger, cfg.(*Config)) if err != nil { return nil, err } @@ -86,11 +86,11 @@ func createMetricsProcessor( func createLogsProcessor( _ context.Context, - params component.ProcessorCreateParams, + set component.ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Logs, ) (component.LogsProcessor, error) { - ml, err := newMemoryLimiter(params.Logger, cfg.(*Config)) + ml, err := newMemoryLimiter(set.Logger, cfg.(*Config)) if err != nil { return nil, err } diff --git a/processor/memorylimiter/factory_test.go b/processor/memorylimiter/factory_test.go index 0134f2dded1..1ace402d600 100644 --- a/processor/memorylimiter/factory_test.go +++ b/processor/memorylimiter/factory_test.go @@ -44,15 +44,15 @@ func TestCreateProcessor(t *testing.T) { cfg := factory.CreateDefaultConfig() // This processor can't be created with the default config. - tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, cfg, consumertest.NewNop()) + tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{Logger: zap.NewNop()}, cfg, consumertest.NewNop()) assert.Nil(t, tp) assert.Error(t, err, "created processor with invalid settings") - mp, err := factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, cfg, consumertest.NewNop()) + mp, err := factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateSettings{Logger: zap.NewNop()}, cfg, consumertest.NewNop()) assert.Nil(t, mp) assert.Error(t, err, "created processor with invalid settings") - lp, err := factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, cfg, consumertest.NewNop()) + lp, err := factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateSettings{Logger: zap.NewNop()}, cfg, consumertest.NewNop()) assert.Nil(t, lp) assert.Error(t, err, "created processor with invalid settings") @@ -63,17 +63,17 @@ func TestCreateProcessor(t *testing.T) { pCfg.BallastSizeMiB = 2048 pCfg.CheckInterval = 100 * time.Millisecond - tp, err = factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, cfg, consumertest.NewNop()) + tp, err = factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{Logger: zap.NewNop()}, cfg, consumertest.NewNop()) assert.NoError(t, err) assert.NotNil(t, tp) assert.NoError(t, tp.Shutdown(context.Background())) - mp, err = factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, cfg, consumertest.NewNop()) + mp, err = factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateSettings{Logger: zap.NewNop()}, cfg, consumertest.NewNop()) assert.NoError(t, err) assert.NotNil(t, mp) assert.NoError(t, mp.Shutdown(context.Background())) - lp, err = factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, cfg, consumertest.NewNop()) + lp, err = factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateSettings{Logger: zap.NewNop()}, cfg, consumertest.NewNop()) assert.NoError(t, err) assert.NotNil(t, lp) assert.NoError(t, lp.Shutdown(context.Background())) diff --git a/processor/probabilisticsamplerprocessor/factory.go b/processor/probabilisticsamplerprocessor/factory.go index 65d9e1a364f..94353839b88 100644 --- a/processor/probabilisticsamplerprocessor/factory.go +++ b/processor/probabilisticsamplerprocessor/factory.go @@ -45,7 +45,7 @@ func createDefaultConfig() config.Processor { // createTracesProcessor creates a trace processor based on this config. func createTracesProcessor( _ context.Context, - _ component.ProcessorCreateParams, + _ component.ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Traces, ) (component.TracesProcessor, error) { diff --git a/processor/probabilisticsamplerprocessor/factory_test.go b/processor/probabilisticsamplerprocessor/factory_test.go index ebaf7cffddf..fdf275cfca1 100644 --- a/processor/probabilisticsamplerprocessor/factory_test.go +++ b/processor/probabilisticsamplerprocessor/factory_test.go @@ -34,8 +34,8 @@ func TestCreateDefaultConfig(t *testing.T) { func TestCreateProcessor(t *testing.T) { cfg := createDefaultConfig() - params := component.ProcessorCreateParams{Logger: zap.NewNop()} - tp, err := createTracesProcessor(context.Background(), params, cfg, consumertest.NewNop()) + set := component.ProcessorCreateSettings{Logger: zap.NewNop()} + tp, err := createTracesProcessor(context.Background(), set, cfg, consumertest.NewNop()) assert.NotNil(t, tp) assert.NoError(t, err, "cannot create trace processor") } diff --git a/processor/processorhelper/factory.go b/processor/processorhelper/factory.go index ddab5a7fcb8..6d7794a9fc8 100644 --- a/processor/processorhelper/factory.go +++ b/processor/processorhelper/factory.go @@ -29,13 +29,13 @@ type FactoryOption func(o *factory) type CreateDefaultConfig func() config.Processor // CreateTracesProcessor is the equivalent of component.ProcessorFactory.CreateTracesProcessor() -type CreateTracesProcessor func(context.Context, component.ProcessorCreateParams, config.Processor, consumer.Traces) (component.TracesProcessor, error) +type CreateTracesProcessor func(context.Context, component.ProcessorCreateSettings, config.Processor, consumer.Traces) (component.TracesProcessor, error) // CreateMetricsProcessor is the equivalent of component.ProcessorFactory.CreateMetricsProcessor() -type CreateMetricsProcessor func(context.Context, component.ProcessorCreateParams, config.Processor, consumer.Metrics) (component.MetricsProcessor, error) +type CreateMetricsProcessor func(context.Context, component.ProcessorCreateSettings, config.Processor, consumer.Metrics) (component.MetricsProcessor, error) // CreateLogsProcessor is the equivalent of component.ProcessorFactory.CreateLogsProcessor() -type CreateLogsProcessor func(context.Context, component.ProcessorCreateParams, config.Processor, consumer.Logs) (component.LogsProcessor, error) +type CreateLogsProcessor func(context.Context, component.ProcessorCreateSettings, config.Processor, consumer.Logs) (component.LogsProcessor, error) type factory struct { component.BaseProcessorFactory @@ -95,38 +95,38 @@ func (f *factory) CreateDefaultConfig() config.Processor { // CreateTracesProcessor creates a component.TracesProcessor based on this config. func (f *factory) CreateTracesProcessor( ctx context.Context, - params component.ProcessorCreateParams, + set component.ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Traces, ) (component.TracesProcessor, error) { if f.createTracesProcessor == nil { - return f.BaseProcessorFactory.CreateTracesProcessor(ctx, params, cfg, nextConsumer) + return f.BaseProcessorFactory.CreateTracesProcessor(ctx, set, cfg, nextConsumer) } - return f.createTracesProcessor(ctx, params, cfg, nextConsumer) + return f.createTracesProcessor(ctx, set, cfg, nextConsumer) } // CreateMetricsProcessor creates a component.MetricsProcessor based on this config. func (f *factory) CreateMetricsProcessor( ctx context.Context, - params component.ProcessorCreateParams, + set component.ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Metrics, ) (component.MetricsProcessor, error) { if f.createMetricsProcessor == nil { - return f.BaseProcessorFactory.CreateMetricsProcessor(ctx, params, cfg, nextConsumer) + return f.BaseProcessorFactory.CreateMetricsProcessor(ctx, set, cfg, nextConsumer) } - return f.createMetricsProcessor(ctx, params, cfg, nextConsumer) + return f.createMetricsProcessor(ctx, set, cfg, nextConsumer) } // CreateLogsProcessor creates a component.LogsProcessor based on this config. func (f *factory) CreateLogsProcessor( ctx context.Context, - params component.ProcessorCreateParams, + set component.ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Logs, ) (component.LogsProcessor, error) { if f.createLogsProcessor == nil { - return f.BaseProcessorFactory.CreateLogsProcessor(ctx, params, cfg, nextConsumer) + return f.BaseProcessorFactory.CreateLogsProcessor(ctx, set, cfg, nextConsumer) } - return f.createLogsProcessor(ctx, params, cfg, nextConsumer) + return f.createLogsProcessor(ctx, set, cfg, nextConsumer) } diff --git a/processor/processorhelper/factory_test.go b/processor/processorhelper/factory_test.go index 248d975c21e..270e81b2fdf 100644 --- a/processor/processorhelper/factory_test.go +++ b/processor/processorhelper/factory_test.go @@ -35,11 +35,11 @@ func TestNewTrace(t *testing.T) { defaultConfig) assert.EqualValues(t, typeStr, factory.Type()) assert.EqualValues(t, &defaultCfg, factory.CreateDefaultConfig()) - _, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{}, &defaultCfg, nil) + _, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{}, &defaultCfg, nil) assert.Error(t, err) - _, err = factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateParams{}, &defaultCfg, nil) + _, err = factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateSettings{}, &defaultCfg, nil) assert.Error(t, err) - _, err = factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateParams{}, &defaultCfg, nil) + _, err = factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateSettings{}, &defaultCfg, nil) assert.Error(t, err) } @@ -53,13 +53,13 @@ func TestNewMetrics_WithConstructors(t *testing.T) { assert.EqualValues(t, typeStr, factory.Type()) assert.EqualValues(t, &defaultCfg, factory.CreateDefaultConfig()) - _, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{}, &defaultCfg, nil) + _, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{}, &defaultCfg, nil) assert.NoError(t, err) - _, err = factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateParams{}, &defaultCfg, nil) + _, err = factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateSettings{}, &defaultCfg, nil) assert.NoError(t, err) - _, err = factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateParams{}, &defaultCfg, nil) + _, err = factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateSettings{}, &defaultCfg, nil) assert.NoError(t, err) } @@ -67,14 +67,14 @@ func defaultConfig() config.Processor { return &defaultCfg } -func createTracesProcessor(context.Context, component.ProcessorCreateParams, config.Processor, consumer.Traces) (component.TracesProcessor, error) { +func createTracesProcessor(context.Context, component.ProcessorCreateSettings, config.Processor, consumer.Traces) (component.TracesProcessor, error) { return nil, nil } -func createMetricsProcessor(context.Context, component.ProcessorCreateParams, config.Processor, consumer.Metrics) (component.MetricsProcessor, error) { +func createMetricsProcessor(context.Context, component.ProcessorCreateSettings, config.Processor, consumer.Metrics) (component.MetricsProcessor, error) { return nil, nil } -func createLogsProcessor(context.Context, component.ProcessorCreateParams, config.Processor, consumer.Logs) (component.LogsProcessor, error) { +func createLogsProcessor(context.Context, component.ProcessorCreateSettings, config.Processor, consumer.Logs) (component.LogsProcessor, error) { return nil, nil } diff --git a/processor/resourceprocessor/factory.go b/processor/resourceprocessor/factory.go index 12cf9fbcdc9..f3c8ff07e64 100644 --- a/processor/resourceprocessor/factory.go +++ b/processor/resourceprocessor/factory.go @@ -50,7 +50,7 @@ func createDefaultConfig() config.Processor { func createTracesProcessor( _ context.Context, - _ component.ProcessorCreateParams, + _ component.ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Traces) (component.TracesProcessor, error) { attrProc, err := createAttrProcessor(cfg.(*Config)) @@ -66,7 +66,7 @@ func createTracesProcessor( func createMetricsProcessor( _ context.Context, - _ component.ProcessorCreateParams, + _ component.ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Metrics) (component.MetricsProcessor, error) { attrProc, err := createAttrProcessor(cfg.(*Config)) @@ -82,7 +82,7 @@ func createMetricsProcessor( func createLogsProcessor( _ context.Context, - _ component.ProcessorCreateParams, + _ component.ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Logs) (component.LogsProcessor, error) { attrProc, err := createAttrProcessor(cfg.(*Config)) diff --git a/processor/resourceprocessor/factory_test.go b/processor/resourceprocessor/factory_test.go index 37e5baba89a..bc543da7f75 100644 --- a/processor/resourceprocessor/factory_test.go +++ b/processor/resourceprocessor/factory_test.go @@ -43,11 +43,11 @@ func TestCreateProcessor(t *testing.T) { }, } - tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) assert.NoError(t, err) assert.NotNil(t, tp) - mp, err := factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + mp, err := factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) assert.NoError(t, err) assert.NotNil(t, mp) } @@ -56,10 +56,10 @@ func TestInvalidEmptyActions(t *testing.T) { factory := NewFactory() cfg := factory.CreateDefaultConfig() - _, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + _, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) assert.Error(t, err) - _, err = factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + _, err = factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) assert.Error(t, err) } @@ -72,9 +72,9 @@ func TestInvalidAttributeActions(t *testing.T) { }, } - _, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, nil) + _, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, nil) assert.Error(t, err) - _, err = factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, nil) + _, err = factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, nil) assert.Error(t, err) } diff --git a/processor/resourceprocessor/resource_processor_test.go b/processor/resourceprocessor/resource_processor_test.go index 20cd09ce6f3..f8a006c3a61 100644 --- a/processor/resourceprocessor/resource_processor_test.go +++ b/processor/resourceprocessor/resource_processor_test.go @@ -101,7 +101,7 @@ func TestResourceProcessorAttributesUpsert(t *testing.T) { ttn := new(consumertest.TracesSink) factory := NewFactory() - rtp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{}, tt.config, ttn) + rtp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{}, tt.config, ttn) require.NoError(t, err) assert.True(t, rtp.Capabilities().MutatesData) @@ -116,7 +116,7 @@ func TestResourceProcessorAttributesUpsert(t *testing.T) { // Test metrics consumer tmn := new(consumertest.MetricsSink) - rmp, err := factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateParams{}, tt.config, tmn) + rmp, err := factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateSettings{}, tt.config, tmn) require.NoError(t, err) assert.True(t, rtp.Capabilities().MutatesData) @@ -131,7 +131,7 @@ func TestResourceProcessorAttributesUpsert(t *testing.T) { // Test logs consumer tln := new(consumertest.LogsSink) - rlp, err := factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateParams{}, tt.config, tln) + rlp, err := factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateSettings{}, tt.config, tln) require.NoError(t, err) assert.True(t, rtp.Capabilities().MutatesData) @@ -155,17 +155,17 @@ func TestResourceProcessorError(t *testing.T) { // Test traces consumer factory := NewFactory() - rtp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{}, badCfg, consumertest.NewNop()) + rtp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{}, badCfg, consumertest.NewNop()) require.Error(t, err) require.Nil(t, rtp) // Test metrics consumer - rmp, err := factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateParams{}, badCfg, consumertest.NewNop()) + rmp, err := factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateSettings{}, badCfg, consumertest.NewNop()) require.Error(t, err) require.Nil(t, rmp) // Test logs consumer - rlp, err := factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateParams{}, badCfg, consumertest.NewNop()) + rlp, err := factory.CreateLogsProcessor(context.Background(), component.ProcessorCreateSettings{}, badCfg, consumertest.NewNop()) require.Error(t, err) require.Nil(t, rlp) } diff --git a/processor/spanprocessor/factory.go b/processor/spanprocessor/factory.go index f58c4f6a5d4..0f6c016f8e9 100644 --- a/processor/spanprocessor/factory.go +++ b/processor/spanprocessor/factory.go @@ -53,7 +53,7 @@ func createDefaultConfig() config.Processor { func createTracesProcessor( _ context.Context, - _ component.ProcessorCreateParams, + _ component.ProcessorCreateSettings, cfg config.Processor, nextConsumer consumer.Traces, ) (component.TracesProcessor, error) { diff --git a/processor/spanprocessor/factory_test.go b/processor/spanprocessor/factory_test.go index 6b9b3225cb6..aecc8ee6b53 100644 --- a/processor/spanprocessor/factory_test.go +++ b/processor/spanprocessor/factory_test.go @@ -52,7 +52,7 @@ func TestFactory_CreateTracesProcessor(t *testing.T) { // Name.FromAttributes field needs to be set for the configuration to be valid. oCfg.Rename.FromAttributes = []string{"test-key"} - tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, oCfg, consumertest.NewNop()) + tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{Logger: zap.NewNop()}, oCfg, consumertest.NewNop()) require.Nil(t, err) assert.NotNil(t, tp) @@ -89,7 +89,7 @@ func TestFactory_CreateTracesProcessor_InvalidConfig(t *testing.T) { cfg := factory.CreateDefaultConfig().(*Config) cfg.Rename = test.cfg - tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, cfg, consumertest.NewNop()) + tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{Logger: zap.NewNop()}, cfg, consumertest.NewNop()) require.Nil(t, tp) assert.EqualValues(t, err, test.err) }) @@ -100,7 +100,7 @@ func TestFactory_CreateMetricProcessor(t *testing.T) { factory := NewFactory() cfg := factory.CreateDefaultConfig() - mp, err := factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, cfg, nil) + mp, err := factory.CreateMetricsProcessor(context.Background(), component.ProcessorCreateSettings{Logger: zap.NewNop()}, cfg, nil) require.Nil(t, mp) assert.Equal(t, err, componenterror.ErrDataTypeIsNotSupported) } diff --git a/processor/spanprocessor/span_test.go b/processor/spanprocessor/span_test.go index 567690895c1..ddcd97606e5 100644 --- a/processor/spanprocessor/span_test.go +++ b/processor/spanprocessor/span_test.go @@ -37,11 +37,11 @@ func TestNewTracesProcessor(t *testing.T) { cfg := factory.CreateDefaultConfig() oCfg := cfg.(*Config) oCfg.Rename.FromAttributes = []string{"foo"} - tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, nil) + tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, nil) require.Error(t, componenterror.ErrNilNextConsumer, err) require.Nil(t, tp) - tp, err = factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{}, cfg, consumertest.NewNop()) + tp, err = factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) require.Nil(t, err) require.NotNil(t, tp) } @@ -129,7 +129,7 @@ func TestSpanProcessor_NilEmptyData(t *testing.T) { } oCfg.Rename.FromAttributes = []string{"key"} - tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, oCfg, consumertest.NewNop()) + tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{Logger: zap.NewNop()}, oCfg, consumertest.NewNop()) require.Nil(t, err) require.NotNil(t, tp) for i := range testCases { @@ -233,7 +233,7 @@ func TestSpanProcessor_Values(t *testing.T) { oCfg := cfg.(*Config) oCfg.Rename.FromAttributes = []string{"key1"} - tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, oCfg, consumertest.NewNop()) + tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{Logger: zap.NewNop()}, oCfg, consumertest.NewNop()) require.Nil(t, err) require.NotNil(t, tp) for _, tc := range testCases { @@ -309,7 +309,7 @@ func TestSpanProcessor_MissingKeys(t *testing.T) { oCfg.Rename.FromAttributes = []string{"key1", "key2", "key3", "key4"} oCfg.Rename.Separator = "::" - tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, oCfg, consumertest.NewNop()) + tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{Logger: zap.NewNop()}, oCfg, consumertest.NewNop()) require.Nil(t, err) require.NotNil(t, tp) for _, tc := range testCases { @@ -327,7 +327,7 @@ func TestSpanProcessor_Separator(t *testing.T) { oCfg.Rename.FromAttributes = []string{"key1"} oCfg.Rename.Separator = "::" - tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, oCfg, consumertest.NewNop()) + tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{Logger: zap.NewNop()}, oCfg, consumertest.NewNop()) require.Nil(t, err) require.NotNil(t, tp) @@ -356,7 +356,7 @@ func TestSpanProcessor_NoSeparatorMultipleKeys(t *testing.T) { oCfg.Rename.FromAttributes = []string{"key1", "key2"} oCfg.Rename.Separator = "" - tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, oCfg, consumertest.NewNop()) + tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{Logger: zap.NewNop()}, oCfg, consumertest.NewNop()) require.Nil(t, err) require.NotNil(t, tp) @@ -386,7 +386,7 @@ func TestSpanProcessor_SeparatorMultipleKeys(t *testing.T) { oCfg.Rename.FromAttributes = []string{"key1", "key2", "key3", "key4"} oCfg.Rename.Separator = "::" - tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, oCfg, consumertest.NewNop()) + tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{Logger: zap.NewNop()}, oCfg, consumertest.NewNop()) require.Nil(t, err) require.NotNil(t, tp) @@ -421,7 +421,7 @@ func TestSpanProcessor_NilName(t *testing.T) { oCfg.Rename.FromAttributes = []string{"key1"} oCfg.Rename.Separator = "::" - tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, oCfg, consumertest.NewNop()) + tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{Logger: zap.NewNop()}, oCfg, consumertest.NewNop()) require.Nil(t, err) require.NotNil(t, tp) @@ -518,7 +518,7 @@ func TestSpanProcessor_ToAttributes(t *testing.T) { for _, tc := range testCases { oCfg.Rename.ToAttributes.Rules = tc.rules oCfg.Rename.ToAttributes.BreakAfterMatch = tc.breakAfterMatch - tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, oCfg, consumertest.NewNop()) + tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{Logger: zap.NewNop()}, oCfg, consumertest.NewNop()) require.Nil(t, err) require.NotNil(t, tp) @@ -585,7 +585,7 @@ func TestSpanProcessor_skipSpan(t *testing.T) { oCfg.Rename.ToAttributes = &ToAttributes{ Rules: []string{`(?P.*?)$`}, } - tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateParams{Logger: zap.NewNop()}, oCfg, consumertest.NewNop()) + tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{Logger: zap.NewNop()}, oCfg, consumertest.NewNop()) require.Nil(t, err) require.NotNil(t, tp) diff --git a/service/defaultcomponents/default_processors_test.go b/service/defaultcomponents/default_processors_test.go index abdc8319ffe..f3a69a7e941 100644 --- a/service/defaultcomponents/default_processors_test.go +++ b/service/defaultcomponents/default_processors_test.go @@ -117,7 +117,7 @@ type getProcessorConfigFn func() config.Processor func verifyProcessorLifecycle(t *testing.T, factory component.ProcessorFactory, getConfigFn getProcessorConfigFn) { ctx := context.Background() host := newAssertNoErrorHost(t) - processorCreateParams := component.ProcessorCreateParams{ + processorCreationSet := component.ProcessorCreateSettings{ Logger: zap.NewNop(), BuildInfo: component.DefaultBuildInfo(), } @@ -133,7 +133,7 @@ func verifyProcessorLifecycle(t *testing.T, factory component.ProcessorFactory, } for _, createFn := range createFns { - firstExp, err := createFn(ctx, processorCreateParams, getConfigFn()) + firstExp, err := createFn(ctx, processorCreationSet, getConfigFn()) if errors.Is(err, componenterror.ErrDataTypeIsNotSupported) { continue } @@ -141,7 +141,7 @@ func verifyProcessorLifecycle(t *testing.T, factory component.ProcessorFactory, require.NoError(t, firstExp.Start(ctx, host)) require.NoError(t, firstExp.Shutdown(ctx)) - secondExp, err := createFn(ctx, processorCreateParams, getConfigFn()) + secondExp, err := createFn(ctx, processorCreationSet, getConfigFn()) require.NoError(t, err) require.NoError(t, secondExp.Start(ctx, host)) require.NoError(t, secondExp.Shutdown(ctx)) @@ -150,24 +150,24 @@ func verifyProcessorLifecycle(t *testing.T, factory component.ProcessorFactory, type createProcessorFn func( ctx context.Context, - params component.ProcessorCreateParams, + set component.ProcessorCreateSettings, cfg config.Processor, ) (component.Processor, error) func wrapCreateLogsProc(factory component.ProcessorFactory) createProcessorFn { - return func(ctx context.Context, params component.ProcessorCreateParams, cfg config.Processor) (component.Processor, error) { - return factory.CreateLogsProcessor(ctx, params, cfg, consumertest.NewNop()) + return func(ctx context.Context, set component.ProcessorCreateSettings, cfg config.Processor) (component.Processor, error) { + return factory.CreateLogsProcessor(ctx, set, cfg, consumertest.NewNop()) } } func wrapCreateMetricsProc(factory component.ProcessorFactory) createProcessorFn { - return func(ctx context.Context, params component.ProcessorCreateParams, cfg config.Processor) (component.Processor, error) { - return factory.CreateMetricsProcessor(ctx, params, cfg, consumertest.NewNop()) + return func(ctx context.Context, set component.ProcessorCreateSettings, cfg config.Processor) (component.Processor, error) { + return factory.CreateMetricsProcessor(ctx, set, cfg, consumertest.NewNop()) } } func wrapCreateTracesProc(factory component.ProcessorFactory) createProcessorFn { - return func(ctx context.Context, params component.ProcessorCreateParams, cfg config.Processor) (component.Processor, error) { - return factory.CreateTracesProcessor(ctx, params, cfg, consumertest.NewNop()) + return func(ctx context.Context, set component.ProcessorCreateSettings, cfg config.Processor) (component.Processor, error) { + return factory.CreateTracesProcessor(ctx, set, cfg, consumertest.NewNop()) } } diff --git a/service/internal/builder/pipelines_builder.go b/service/internal/builder/pipelines_builder.go index 3175b241eba..33bb10ba4d4 100644 --- a/service/internal/builder/pipelines_builder.go +++ b/service/internal/builder/pipelines_builder.go @@ -151,7 +151,7 @@ func (pb *pipelinesBuilder) buildPipeline(ctx context.Context, pipelineCfg *conf // which we will build in the next loop iteration). var err error componentLogger := pb.logger.With(zap.String(zapKindKey, zapKindProcessor), zap.Stringer(zapNameKey, procCfg.ID())) - creationParams := component.ProcessorCreateParams{ + creationSet := component.ProcessorCreateSettings{ Logger: componentLogger, BuildInfo: pb.buildInfo, } @@ -159,7 +159,7 @@ func (pb *pipelinesBuilder) buildPipeline(ctx context.Context, pipelineCfg *conf switch pipelineCfg.InputType { case config.TracesDataType: var proc component.TracesProcessor - proc, err = factory.CreateTracesProcessor(ctx, creationParams, procCfg, tc) + proc, err = factory.CreateTracesProcessor(ctx, creationSet, procCfg, tc) if proc != nil { mutatesConsumedData = mutatesConsumedData || proc.Capabilities().MutatesData } @@ -167,7 +167,7 @@ func (pb *pipelinesBuilder) buildPipeline(ctx context.Context, pipelineCfg *conf tc = proc case config.MetricsDataType: var proc component.MetricsProcessor - proc, err = factory.CreateMetricsProcessor(ctx, creationParams, procCfg, mc) + proc, err = factory.CreateMetricsProcessor(ctx, creationSet, procCfg, mc) if proc != nil { mutatesConsumedData = mutatesConsumedData || proc.Capabilities().MutatesData } @@ -176,7 +176,7 @@ func (pb *pipelinesBuilder) buildPipeline(ctx context.Context, pipelineCfg *conf case config.LogsDataType: var proc component.LogsProcessor - proc, err = factory.CreateLogsProcessor(ctx, creationParams, procCfg, lc) + proc, err = factory.CreateLogsProcessor(ctx, creationSet, procCfg, lc) if proc != nil { mutatesConsumedData = mutatesConsumedData || proc.Capabilities().MutatesData } From ef148ec4c2a31193b06cfde1b96af32c31538387 Mon Sep 17 00:00:00 2001 From: Patryk Matyjasek Date: Wed, 2 Jun 2021 11:12:35 +0200 Subject: [PATCH 2/2] Update changelog Signed-off-by: Patryk Matyjasek # Conflicts: # CHANGELOG.md # Conflicts: # CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ff52375529..cbdbed889a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Move BigEndian helper functions in `tracetranslator` to an internal package.(#3298) - Rename `configtest.LoadConfigFile` to `configtest.LoadConfigAndValidate` (#3306) - Replace `ExtensionCreateParams` with `ExtensionCreateSettings` (#3294) +- Replace `ProcessorCreateParams` with `ProcessorCreateSettings`. (#3181) ## 💡 Enhancements 💡