diff --git a/exporter/exporterhelper/logs.go b/exporter/exporterhelper/logs.go index be4f2ae6e6c..00e6ff33ece 100644 --- a/exporter/exporterhelper/logs.go +++ b/exporter/exporterhelper/logs.go @@ -78,18 +78,19 @@ type logsExporter struct { consumer.Logs } -// Deprecated: [v0.58.0] use NewLogsExporterWithContext. -func NewLogsExporter( - cfg config.Exporter, +// Deprecated: [v0.58.0] use NewLogsExporter. +func NewLogsExporterWithContext( + ctx context.Context, set component.ExporterCreateSettings, + cfg config.Exporter, pusher consumer.ConsumeLogsFunc, options ...Option, ) (component.LogsExporter, error) { - return NewLogsExporterWithContext(context.Background(), set, cfg, pusher, options...) + return NewLogsExporter(ctx, set, cfg, pusher, options...) } -// NewLogsExporterWithContext creates an LogsExporter that records observability metrics and wraps every request with a Span. -func NewLogsExporterWithContext( +// NewLogsExporter creates a component.LogsExporter that records observability metrics and wraps every request with a Span. +func NewLogsExporter( _ context.Context, set component.ExporterCreateSettings, cfg config.Exporter, diff --git a/exporter/exporterhelper/logs_test.go b/exporter/exporterhelper/logs_test.go index f9c42126e19..5f06078579b 100644 --- a/exporter/exporterhelper/logs_test.go +++ b/exporter/exporterhelper/logs_test.go @@ -59,26 +59,26 @@ func TestLogsRequest(t *testing.T) { } func TestLogsExporter_InvalidName(t *testing.T) { - le, err := NewLogsExporterWithContext(context.Background(), componenttest.NewNopExporterCreateSettings(), nil, newPushLogsData(nil)) + le, err := NewLogsExporter(context.Background(), componenttest.NewNopExporterCreateSettings(), nil, newPushLogsData(nil)) require.Nil(t, le) require.Equal(t, errNilConfig, err) } func TestLogsExporter_NilLogger(t *testing.T) { - le, err := NewLogsExporterWithContext(context.Background(), component.ExporterCreateSettings{}, &fakeLogsExporterConfig, newPushLogsData(nil)) + le, err := NewLogsExporter(context.Background(), component.ExporterCreateSettings{}, &fakeLogsExporterConfig, newPushLogsData(nil)) require.Nil(t, le) require.Equal(t, errNilLogger, err) } func TestLogsExporter_NilPushLogsData(t *testing.T) { - le, err := NewLogsExporterWithContext(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeLogsExporterConfig, nil) + le, err := NewLogsExporter(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeLogsExporterConfig, nil) require.Nil(t, le) require.Equal(t, errNilPushLogsData, err) } func TestLogsExporter_Default(t *testing.T) { ld := plog.NewLogs() - le, err := NewLogsExporterWithContext(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeLogsExporterConfig, newPushLogsData(nil)) + le, err := NewLogsExporter(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeLogsExporterConfig, newPushLogsData(nil)) assert.NotNil(t, le) assert.NoError(t, err) @@ -90,7 +90,7 @@ func TestLogsExporter_Default(t *testing.T) { func TestLogsExporter_WithCapabilities(t *testing.T) { capabilities := consumer.Capabilities{MutatesData: true} - le, err := NewLogsExporterWithContext(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeLogsExporterConfig, newPushLogsData(nil), WithCapabilities(capabilities)) + le, err := NewLogsExporter(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeLogsExporterConfig, newPushLogsData(nil), WithCapabilities(capabilities)) require.NoError(t, err) require.NotNil(t, le) @@ -100,7 +100,7 @@ func TestLogsExporter_WithCapabilities(t *testing.T) { func TestLogsExporter_Default_ReturnError(t *testing.T) { ld := plog.NewLogs() want := errors.New("my_error") - le, err := NewLogsExporterWithContext(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeLogsExporterConfig, newPushLogsData(want)) + le, err := NewLogsExporter(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeLogsExporterConfig, newPushLogsData(want)) require.NoError(t, err) require.NotNil(t, le) require.Equal(t, want, le.ConsumeLogs(context.Background(), ld)) @@ -111,7 +111,7 @@ func TestLogsExporter_WithRecordLogs(t *testing.T) { require.NoError(t, err) t.Cleanup(func() { require.NoError(t, tt.Shutdown(context.Background())) }) - le, err := NewLogsExporterWithContext(context.Background(), tt.ToExporterCreateSettings(), &fakeLogsExporterConfig, newPushLogsData(nil)) + le, err := NewLogsExporter(context.Background(), tt.ToExporterCreateSettings(), &fakeLogsExporterConfig, newPushLogsData(nil)) require.NoError(t, err) require.NotNil(t, le) @@ -124,7 +124,7 @@ func TestLogsExporter_WithRecordLogs_ReturnError(t *testing.T) { require.NoError(t, err) t.Cleanup(func() { require.NoError(t, tt.Shutdown(context.Background())) }) - le, err := NewLogsExporterWithContext(context.Background(), tt.ToExporterCreateSettings(), &fakeLogsExporterConfig, newPushLogsData(want)) + le, err := NewLogsExporter(context.Background(), tt.ToExporterCreateSettings(), &fakeLogsExporterConfig, newPushLogsData(want)) require.Nil(t, err) require.NotNil(t, le) @@ -141,7 +141,7 @@ func TestLogsExporter_WithRecordEnqueueFailedMetrics(t *testing.T) { qCfg.NumConsumers = 1 qCfg.QueueSize = 2 wantErr := errors.New("some-error") - te, err := NewLogsExporterWithContext(context.Background(), tt.ToExporterCreateSettings(), &fakeLogsExporterConfig, newPushLogsData(wantErr), WithRetry(rCfg), WithQueue(qCfg)) + te, err := NewLogsExporter(context.Background(), tt.ToExporterCreateSettings(), &fakeLogsExporterConfig, newPushLogsData(wantErr), WithRetry(rCfg), WithQueue(qCfg)) require.NoError(t, err) require.NotNil(t, te) @@ -163,7 +163,7 @@ func TestLogsExporter_WithSpan(t *testing.T) { otel.SetTracerProvider(set.TracerProvider) defer otel.SetTracerProvider(trace.NewNoopTracerProvider()) - le, err := NewLogsExporterWithContext(context.Background(), set, &fakeLogsExporterConfig, newPushLogsData(nil)) + le, err := NewLogsExporter(context.Background(), set, &fakeLogsExporterConfig, newPushLogsData(nil)) require.Nil(t, err) require.NotNil(t, le) checkWrapSpanForLogsExporter(t, sr, set.TracerProvider.Tracer("test"), le, nil, 1) @@ -177,7 +177,7 @@ func TestLogsExporter_WithSpan_ReturnError(t *testing.T) { defer otel.SetTracerProvider(trace.NewNoopTracerProvider()) want := errors.New("my_error") - le, err := NewLogsExporterWithContext(context.Background(), set, &fakeLogsExporterConfig, newPushLogsData(want)) + le, err := NewLogsExporter(context.Background(), set, &fakeLogsExporterConfig, newPushLogsData(want)) require.Nil(t, err) require.NotNil(t, le) checkWrapSpanForLogsExporter(t, sr, set.TracerProvider.Tracer("test"), le, want, 1) @@ -187,7 +187,7 @@ func TestLogsExporter_WithShutdown(t *testing.T) { shutdownCalled := false shutdown := func(context.Context) error { shutdownCalled = true; return nil } - le, err := NewLogsExporterWithContext(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeLogsExporterConfig, newPushLogsData(nil), WithShutdown(shutdown)) + le, err := NewLogsExporter(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeLogsExporterConfig, newPushLogsData(nil), WithShutdown(shutdown)) assert.NotNil(t, le) assert.NoError(t, err) @@ -199,7 +199,7 @@ func TestLogsExporter_WithShutdown_ReturnError(t *testing.T) { want := errors.New("my_error") shutdownErr := func(context.Context) error { return want } - le, err := NewLogsExporterWithContext(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeLogsExporterConfig, newPushLogsData(nil), WithShutdown(shutdownErr)) + le, err := NewLogsExporter(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeLogsExporterConfig, newPushLogsData(nil), WithShutdown(shutdownErr)) assert.NotNil(t, le) assert.NoError(t, err) diff --git a/exporter/exporterhelper/metrics.go b/exporter/exporterhelper/metrics.go index 9053e883f3d..496127c1fb8 100644 --- a/exporter/exporterhelper/metrics.go +++ b/exporter/exporterhelper/metrics.go @@ -79,18 +79,19 @@ type metricsExporter struct { consumer.Metrics } -// Deprecated: [v0.58.0] use NewMetricsExporterWithContext. -func NewMetricsExporter( - cfg config.Exporter, +// Deprecated: [v0.58.0] use NewMetricsExporter. +func NewMetricsExporterWithContext( + ctx context.Context, set component.ExporterCreateSettings, + cfg config.Exporter, pusher consumer.ConsumeMetricsFunc, options ...Option, ) (component.MetricsExporter, error) { - return NewMetricsExporterWithContext(context.Background(), set, cfg, pusher, options...) + return NewMetricsExporter(ctx, set, cfg, pusher, options...) } -// NewMetricsExporterWithContext creates an MetricsExporter that records observability metrics and wraps every request with a Span. -func NewMetricsExporterWithContext( +// NewMetricsExporter creates a component.MetricsExporter that records observability metrics and wraps every request with a Span. +func NewMetricsExporter( _ context.Context, set component.ExporterCreateSettings, cfg config.Exporter, diff --git a/exporter/exporterhelper/metrics_test.go b/exporter/exporterhelper/metrics_test.go index d38c9f8d5c5..c26a86dbeb5 100644 --- a/exporter/exporterhelper/metrics_test.go +++ b/exporter/exporterhelper/metrics_test.go @@ -58,26 +58,26 @@ func TestMetricsRequest(t *testing.T) { } func TestMetricsExporter_InvalidName(t *testing.T) { - me, err := NewMetricsExporterWithContext(context.Background(), componenttest.NewNopExporterCreateSettings(), nil, newPushMetricsData(nil)) + me, err := NewMetricsExporter(context.Background(), componenttest.NewNopExporterCreateSettings(), nil, newPushMetricsData(nil)) require.Nil(t, me) require.Equal(t, errNilConfig, err) } func TestMetricsExporter_NilLogger(t *testing.T) { - me, err := NewMetricsExporterWithContext(context.Background(), component.ExporterCreateSettings{}, &fakeMetricsExporterConfig, newPushMetricsData(nil)) + me, err := NewMetricsExporter(context.Background(), component.ExporterCreateSettings{}, &fakeMetricsExporterConfig, newPushMetricsData(nil)) require.Nil(t, me) require.Equal(t, errNilLogger, err) } func TestMetricsExporter_NilPushMetricsData(t *testing.T) { - me, err := NewMetricsExporterWithContext(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeMetricsExporterConfig, nil) + me, err := NewMetricsExporter(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeMetricsExporterConfig, nil) require.Nil(t, me) require.Equal(t, errNilPushMetricsData, err) } func TestMetricsExporter_Default(t *testing.T) { md := pmetric.NewMetrics() - me, err := NewMetricsExporterWithContext(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeMetricsExporterConfig, newPushMetricsData(nil)) + me, err := NewMetricsExporter(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeMetricsExporterConfig, newPushMetricsData(nil)) assert.NoError(t, err) assert.NotNil(t, me) @@ -89,7 +89,7 @@ func TestMetricsExporter_Default(t *testing.T) { func TestMetricsExporter_WithCapabilities(t *testing.T) { capabilities := consumer.Capabilities{MutatesData: true} - me, err := NewMetricsExporterWithContext(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeMetricsExporterConfig, newPushMetricsData(nil), WithCapabilities(capabilities)) + me, err := NewMetricsExporter(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeMetricsExporterConfig, newPushMetricsData(nil), WithCapabilities(capabilities)) assert.NoError(t, err) assert.NotNil(t, me) @@ -99,7 +99,7 @@ func TestMetricsExporter_WithCapabilities(t *testing.T) { func TestMetricsExporter_Default_ReturnError(t *testing.T) { md := pmetric.NewMetrics() want := errors.New("my_error") - me, err := NewMetricsExporterWithContext(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeMetricsExporterConfig, newPushMetricsData(want)) + me, err := NewMetricsExporter(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeMetricsExporterConfig, newPushMetricsData(want)) require.NoError(t, err) require.NotNil(t, me) require.Equal(t, want, me.ConsumeMetrics(context.Background(), md)) @@ -110,7 +110,7 @@ func TestMetricsExporter_WithRecordMetrics(t *testing.T) { require.NoError(t, err) t.Cleanup(func() { require.NoError(t, tt.Shutdown(context.Background())) }) - me, err := NewMetricsExporterWithContext(context.Background(), tt.ToExporterCreateSettings(), &fakeMetricsExporterConfig, newPushMetricsData(nil)) + me, err := NewMetricsExporter(context.Background(), tt.ToExporterCreateSettings(), &fakeMetricsExporterConfig, newPushMetricsData(nil)) require.NoError(t, err) require.NotNil(t, me) @@ -123,7 +123,7 @@ func TestMetricsExporter_WithRecordMetrics_ReturnError(t *testing.T) { require.NoError(t, err) t.Cleanup(func() { require.NoError(t, tt.Shutdown(context.Background())) }) - me, err := NewMetricsExporterWithContext(context.Background(), tt.ToExporterCreateSettings(), &fakeMetricsExporterConfig, newPushMetricsData(want)) + me, err := NewMetricsExporter(context.Background(), tt.ToExporterCreateSettings(), &fakeMetricsExporterConfig, newPushMetricsData(want)) require.NoError(t, err) require.NotNil(t, me) @@ -140,7 +140,7 @@ func TestMetricsExporter_WithRecordEnqueueFailedMetrics(t *testing.T) { qCfg.NumConsumers = 1 qCfg.QueueSize = 2 wantErr := errors.New("some-error") - te, err := NewMetricsExporterWithContext(context.Background(), tt.ToExporterCreateSettings(), &fakeMetricsExporterConfig, newPushMetricsData(wantErr), WithRetry(rCfg), WithQueue(qCfg)) + te, err := NewMetricsExporter(context.Background(), tt.ToExporterCreateSettings(), &fakeMetricsExporterConfig, newPushMetricsData(wantErr), WithRetry(rCfg), WithQueue(qCfg)) require.NoError(t, err) require.NotNil(t, te) @@ -162,7 +162,7 @@ func TestMetricsExporter_WithSpan(t *testing.T) { otel.SetTracerProvider(set.TracerProvider) defer otel.SetTracerProvider(trace.NewNoopTracerProvider()) - me, err := NewMetricsExporterWithContext(context.Background(), set, &fakeMetricsExporterConfig, newPushMetricsData(nil)) + me, err := NewMetricsExporter(context.Background(), set, &fakeMetricsExporterConfig, newPushMetricsData(nil)) require.NoError(t, err) require.NotNil(t, me) checkWrapSpanForMetricsExporter(t, sr, set.TracerProvider.Tracer("test"), me, nil, 2) @@ -176,7 +176,7 @@ func TestMetricsExporter_WithSpan_ReturnError(t *testing.T) { defer otel.SetTracerProvider(trace.NewNoopTracerProvider()) want := errors.New("my_error") - me, err := NewMetricsExporterWithContext(context.Background(), set, &fakeMetricsExporterConfig, newPushMetricsData(want)) + me, err := NewMetricsExporter(context.Background(), set, &fakeMetricsExporterConfig, newPushMetricsData(want)) require.NoError(t, err) require.NotNil(t, me) checkWrapSpanForMetricsExporter(t, sr, set.TracerProvider.Tracer("test"), me, want, 2) @@ -186,7 +186,7 @@ func TestMetricsExporter_WithShutdown(t *testing.T) { shutdownCalled := false shutdown := func(context.Context) error { shutdownCalled = true; return nil } - me, err := NewMetricsExporterWithContext(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeMetricsExporterConfig, newPushMetricsData(nil), WithShutdown(shutdown)) + me, err := NewMetricsExporter(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeMetricsExporterConfig, newPushMetricsData(nil), WithShutdown(shutdown)) assert.NotNil(t, me) assert.NoError(t, err) @@ -199,7 +199,7 @@ func TestMetricsExporter_WithShutdown_ReturnError(t *testing.T) { want := errors.New("my_error") shutdownErr := func(context.Context) error { return want } - me, err := NewMetricsExporterWithContext(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeMetricsExporterConfig, newPushMetricsData(nil), WithShutdown(shutdownErr)) + me, err := NewMetricsExporter(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeMetricsExporterConfig, newPushMetricsData(nil), WithShutdown(shutdownErr)) assert.NotNil(t, me) assert.NoError(t, err) diff --git a/exporter/exporterhelper/traces.go b/exporter/exporterhelper/traces.go index f63193ca0db..f2d57744a6e 100644 --- a/exporter/exporterhelper/traces.go +++ b/exporter/exporterhelper/traces.go @@ -79,18 +79,19 @@ type traceExporter struct { consumer.Traces } -// Deprecated: [v0.58.0] use NewTracesExporterWithContext. -func NewTracesExporter( - cfg config.Exporter, +// Deprecated: [v0.58.0] use NewTracesExporter. +func NewTracesExporterWithContext( + ctx context.Context, set component.ExporterCreateSettings, + cfg config.Exporter, pusher consumer.ConsumeTracesFunc, options ...Option, ) (component.TracesExporter, error) { - return NewTracesExporterWithContext(context.Background(), set, cfg, pusher, options...) + return NewTracesExporter(ctx, set, cfg, pusher, options...) } -// NewTracesExporterWithContext creates an TracesExporter that records observability metrics and wraps every request with a Span. -func NewTracesExporterWithContext( +// NewTracesExporter creates a component.TracesExporter that records observability metrics and wraps every request with a Span. +func NewTracesExporter( _ context.Context, set component.ExporterCreateSettings, cfg config.Exporter, diff --git a/exporter/exporterhelper/traces_test.go b/exporter/exporterhelper/traces_test.go index e31ea97fba0..b8c7782185e 100644 --- a/exporter/exporterhelper/traces_test.go +++ b/exporter/exporterhelper/traces_test.go @@ -54,26 +54,26 @@ func TestTracesRequest(t *testing.T) { } func TestTracesExporter_InvalidName(t *testing.T) { - te, err := NewTracesExporterWithContext(context.Background(), componenttest.NewNopExporterCreateSettings(), nil, newTraceDataPusher(nil)) + te, err := NewTracesExporter(context.Background(), componenttest.NewNopExporterCreateSettings(), nil, newTraceDataPusher(nil)) require.Nil(t, te) require.Equal(t, errNilConfig, err) } func TestTracesExporter_NilLogger(t *testing.T) { - te, err := NewTracesExporterWithContext(context.Background(), component.ExporterCreateSettings{}, &fakeTracesExporterConfig, newTraceDataPusher(nil)) + te, err := NewTracesExporter(context.Background(), component.ExporterCreateSettings{}, &fakeTracesExporterConfig, newTraceDataPusher(nil)) require.Nil(t, te) require.Equal(t, errNilLogger, err) } func TestTracesExporter_NilPushTraceData(t *testing.T) { - te, err := NewTracesExporterWithContext(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeTracesExporterConfig, nil) + te, err := NewTracesExporter(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeTracesExporterConfig, nil) require.Nil(t, te) require.Equal(t, errNilPushTraceData, err) } func TestTracesExporter_Default(t *testing.T) { td := ptrace.NewTraces() - te, err := NewTracesExporterWithContext(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeTracesExporterConfig, newTraceDataPusher(nil)) + te, err := NewTracesExporter(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeTracesExporterConfig, newTraceDataPusher(nil)) assert.NotNil(t, te) assert.NoError(t, err) @@ -85,7 +85,7 @@ func TestTracesExporter_Default(t *testing.T) { func TestTracesExporter_WithCapabilities(t *testing.T) { capabilities := consumer.Capabilities{MutatesData: true} - te, err := NewTracesExporterWithContext(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeTracesExporterConfig, newTraceDataPusher(nil), WithCapabilities(capabilities)) + te, err := NewTracesExporter(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeTracesExporterConfig, newTraceDataPusher(nil), WithCapabilities(capabilities)) assert.NotNil(t, te) assert.NoError(t, err) @@ -95,7 +95,7 @@ func TestTracesExporter_WithCapabilities(t *testing.T) { func TestTracesExporter_Default_ReturnError(t *testing.T) { td := ptrace.NewTraces() want := errors.New("my_error") - te, err := NewTracesExporterWithContext(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeTracesExporterConfig, newTraceDataPusher(want)) + te, err := NewTracesExporter(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeTracesExporterConfig, newTraceDataPusher(want)) require.NoError(t, err) require.NotNil(t, te) @@ -108,7 +108,7 @@ func TestTracesExporter_WithRecordMetrics(t *testing.T) { require.NoError(t, err) t.Cleanup(func() { require.NoError(t, tt.Shutdown(context.Background())) }) - te, err := NewTracesExporterWithContext(context.Background(), tt.ToExporterCreateSettings(), &fakeTracesExporterConfig, newTraceDataPusher(nil)) + te, err := NewTracesExporter(context.Background(), tt.ToExporterCreateSettings(), &fakeTracesExporterConfig, newTraceDataPusher(nil)) require.NoError(t, err) require.NotNil(t, te) @@ -121,7 +121,7 @@ func TestTracesExporter_WithRecordMetrics_ReturnError(t *testing.T) { require.NoError(t, err) t.Cleanup(func() { require.NoError(t, tt.Shutdown(context.Background())) }) - te, err := NewTracesExporterWithContext(context.Background(), tt.ToExporterCreateSettings(), &fakeTracesExporterConfig, newTraceDataPusher(want)) + te, err := NewTracesExporter(context.Background(), tt.ToExporterCreateSettings(), &fakeTracesExporterConfig, newTraceDataPusher(want)) require.NoError(t, err) require.NotNil(t, te) @@ -138,7 +138,7 @@ func TestTracesExporter_WithRecordEnqueueFailedMetrics(t *testing.T) { qCfg.NumConsumers = 1 qCfg.QueueSize = 2 wantErr := errors.New("some-error") - te, err := NewTracesExporterWithContext(context.Background(), tt.ToExporterCreateSettings(), &fakeTracesExporterConfig, newTraceDataPusher(wantErr), WithRetry(rCfg), WithQueue(qCfg)) + te, err := NewTracesExporter(context.Background(), tt.ToExporterCreateSettings(), &fakeTracesExporterConfig, newTraceDataPusher(wantErr), WithRetry(rCfg), WithQueue(qCfg)) require.NoError(t, err) require.NotNil(t, te) @@ -160,7 +160,7 @@ func TestTracesExporter_WithSpan(t *testing.T) { otel.SetTracerProvider(set.TracerProvider) defer otel.SetTracerProvider(trace.NewNoopTracerProvider()) - te, err := NewTracesExporterWithContext(context.Background(), set, &fakeTracesExporterConfig, newTraceDataPusher(nil)) + te, err := NewTracesExporter(context.Background(), set, &fakeTracesExporterConfig, newTraceDataPusher(nil)) require.NoError(t, err) require.NotNil(t, te) @@ -175,7 +175,7 @@ func TestTracesExporter_WithSpan_ReturnError(t *testing.T) { defer otel.SetTracerProvider(trace.NewNoopTracerProvider()) want := errors.New("my_error") - te, err := NewTracesExporterWithContext(context.Background(), set, &fakeTracesExporterConfig, newTraceDataPusher(want)) + te, err := NewTracesExporter(context.Background(), set, &fakeTracesExporterConfig, newTraceDataPusher(want)) require.NoError(t, err) require.NotNil(t, te) @@ -186,7 +186,7 @@ func TestTracesExporter_WithShutdown(t *testing.T) { shutdownCalled := false shutdown := func(context.Context) error { shutdownCalled = true; return nil } - te, err := NewTracesExporterWithContext(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeTracesExporterConfig, newTraceDataPusher(nil), WithShutdown(shutdown)) + te, err := NewTracesExporter(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeTracesExporterConfig, newTraceDataPusher(nil), WithShutdown(shutdown)) assert.NotNil(t, te) assert.NoError(t, err) @@ -199,7 +199,7 @@ func TestTracesExporter_WithShutdown_ReturnError(t *testing.T) { want := errors.New("my_error") shutdownErr := func(context.Context) error { return want } - te, err := NewTracesExporterWithContext(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeTracesExporterConfig, newTraceDataPusher(nil), WithShutdown(shutdownErr)) + te, err := NewTracesExporter(context.Background(), componenttest.NewNopExporterCreateSettings(), &fakeTracesExporterConfig, newTraceDataPusher(nil), WithShutdown(shutdownErr)) assert.NotNil(t, te) assert.NoError(t, err) diff --git a/exporter/loggingexporter/factory.go b/exporter/loggingexporter/factory.go index 002b2a3bcd3..ac8dc22e409 100644 --- a/exporter/loggingexporter/factory.go +++ b/exporter/loggingexporter/factory.go @@ -58,7 +58,7 @@ func createTracesExporter(ctx context.Context, set component.ExporterCreateSetti cfg := config.(*Config) exporterLogger := createLogger(cfg, set.TelemetrySettings.Logger) s := newLoggingExporter(exporterLogger, cfg.LogLevel) - return exporterhelper.NewTracesExporterWithContext(ctx, set, cfg, + return exporterhelper.NewTracesExporter(ctx, set, cfg, s.pushTraces, exporterhelper.WithCapabilities(consumer.Capabilities{MutatesData: false}), // Disable Timeout/RetryOnFailure and SendingQueue @@ -73,7 +73,7 @@ func createMetricsExporter(ctx context.Context, set component.ExporterCreateSett cfg := config.(*Config) exporterLogger := createLogger(cfg, set.TelemetrySettings.Logger) s := newLoggingExporter(exporterLogger, cfg.LogLevel) - return exporterhelper.NewMetricsExporterWithContext(ctx, set, cfg, + return exporterhelper.NewMetricsExporter(ctx, set, cfg, s.pushMetrics, exporterhelper.WithCapabilities(consumer.Capabilities{MutatesData: false}), // Disable Timeout/RetryOnFailure and SendingQueue @@ -88,7 +88,7 @@ func createLogsExporter(ctx context.Context, set component.ExporterCreateSetting cfg := config.(*Config) exporterLogger := createLogger(cfg, set.TelemetrySettings.Logger) s := newLoggingExporter(exporterLogger, cfg.LogLevel) - return exporterhelper.NewLogsExporterWithContext(ctx, set, cfg, + return exporterhelper.NewLogsExporter(ctx, set, cfg, s.pushLogs, exporterhelper.WithCapabilities(consumer.Capabilities{MutatesData: false}), // Disable Timeout/RetryOnFailure and SendingQueue diff --git a/exporter/otlpexporter/factory.go b/exporter/otlpexporter/factory.go index 284fb6f2dc0..8195a9b4fc6 100644 --- a/exporter/otlpexporter/factory.go +++ b/exporter/otlpexporter/factory.go @@ -67,7 +67,7 @@ func createTracesExporter( return nil, err } oCfg := cfg.(*Config) - return exporterhelper.NewTracesExporterWithContext(ctx, set, cfg, + return exporterhelper.NewTracesExporter(ctx, set, cfg, oce.pushTraces, exporterhelper.WithCapabilities(consumer.Capabilities{MutatesData: false}), exporterhelper.WithTimeout(oCfg.TimeoutSettings), @@ -87,7 +87,7 @@ func createMetricsExporter( return nil, err } oCfg := cfg.(*Config) - return exporterhelper.NewMetricsExporterWithContext(ctx, set, cfg, + return exporterhelper.NewMetricsExporter(ctx, set, cfg, oce.pushMetrics, exporterhelper.WithCapabilities(consumer.Capabilities{MutatesData: false}), exporterhelper.WithTimeout(oCfg.TimeoutSettings), @@ -108,7 +108,7 @@ func createLogsExporter( return nil, err } oCfg := cfg.(*Config) - return exporterhelper.NewLogsExporterWithContext(ctx, set, cfg, + return exporterhelper.NewLogsExporter(ctx, set, cfg, oce.pushLogs, exporterhelper.WithCapabilities(consumer.Capabilities{MutatesData: false}), exporterhelper.WithTimeout(oCfg.TimeoutSettings), diff --git a/exporter/otlphttpexporter/factory.go b/exporter/otlphttpexporter/factory.go index 23c87e73417..4a96dd89426 100644 --- a/exporter/otlphttpexporter/factory.go +++ b/exporter/otlphttpexporter/factory.go @@ -92,7 +92,7 @@ func createTracesExporter( return nil, err } - return exporterhelper.NewTracesExporterWithContext(ctx, set, cfg, + return exporterhelper.NewTracesExporter(ctx, set, cfg, oce.pushTraces, exporterhelper.WithStart(oce.start), exporterhelper.WithCapabilities(consumer.Capabilities{MutatesData: false}), @@ -118,7 +118,7 @@ func createMetricsExporter( return nil, err } - return exporterhelper.NewMetricsExporterWithContext(ctx, set, cfg, + return exporterhelper.NewMetricsExporter(ctx, set, cfg, oce.pushMetrics, exporterhelper.WithStart(oce.start), exporterhelper.WithCapabilities(consumer.Capabilities{MutatesData: false}), @@ -144,7 +144,7 @@ func createLogsExporter( return nil, err } - return exporterhelper.NewLogsExporterWithContext(ctx, set, cfg, + return exporterhelper.NewLogsExporter(ctx, set, cfg, oce.pushLogs, exporterhelper.WithStart(oce.start), exporterhelper.WithCapabilities(consumer.Capabilities{MutatesData: false}),