diff --git a/exporter/alibabacloudlogserviceexporter/go.mod b/exporter/alibabacloudlogserviceexporter/go.mod index 0f75744d48cb..5f951049d694 100644 --- a/exporter/alibabacloudlogserviceexporter/go.mod +++ b/exporter/alibabacloudlogserviceexporter/go.mod @@ -12,6 +12,7 @@ require ( go.opentelemetry.io/collector/confmap v0.97.1-0.20240409140257-792fac1b62d4 go.opentelemetry.io/collector/exporter v0.97.1-0.20240409140257-792fac1b62d4 go.opentelemetry.io/collector/pdata v1.4.1-0.20240409140257-792fac1b62d4 + go.opentelemetry.io/collector/pdata/testdata v0.0.0-20240408153657-fc289290613a go.opentelemetry.io/collector/semconv v0.97.1-0.20240409140257-792fac1b62d4 go.opentelemetry.io/otel/metric v1.24.0 go.opentelemetry.io/otel/trace v1.24.0 diff --git a/exporter/alibabacloudlogserviceexporter/metrics_exporter_test.go b/exporter/alibabacloudlogserviceexporter/metrics_exporter_test.go index 5356bd578083..a3fc451a0fba 100644 --- a/exporter/alibabacloudlogserviceexporter/metrics_exporter_test.go +++ b/exporter/alibabacloudlogserviceexporter/metrics_exporter_test.go @@ -10,8 +10,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/exporter/exportertest" - - "github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/testdata" + "go.opentelemetry.io/collector/pdata/testdata" ) func TestNewMetricsExporter(t *testing.T) { @@ -24,7 +23,7 @@ func TestNewMetricsExporter(t *testing.T) { require.NotNil(t, got) // This will put trace data to send buffer and return success. - err = got.ConsumeMetrics(context.Background(), testdata.GenerateMetricsOneMetric()) + err = got.ConsumeMetrics(context.Background(), testdata.GenerateMetrics(1)) assert.NoError(t, err) } diff --git a/exporter/kafkaexporter/go.mod b/exporter/kafkaexporter/go.mod index 4efe91efccfb..cee091ea4f44 100644 --- a/exporter/kafkaexporter/go.mod +++ b/exporter/kafkaexporter/go.mod @@ -21,6 +21,7 @@ require ( go.opentelemetry.io/collector/consumer v0.97.1-0.20240409140257-792fac1b62d4 go.opentelemetry.io/collector/exporter v0.97.1-0.20240409140257-792fac1b62d4 go.opentelemetry.io/collector/pdata v1.4.1-0.20240409140257-792fac1b62d4 + go.opentelemetry.io/collector/pdata/testdata v0.0.0-20240408153657-fc289290613a go.opentelemetry.io/collector/semconv v0.97.1-0.20240409140257-792fac1b62d4 go.opentelemetry.io/otel/metric v1.24.0 go.opentelemetry.io/otel/trace v1.24.0 diff --git a/exporter/kafkaexporter/kafka_exporter_test.go b/exporter/kafkaexporter/kafka_exporter_test.go index ef9701f53b45..fe6eedf47163 100644 --- a/exporter/kafkaexporter/kafka_exporter_test.go +++ b/exporter/kafkaexporter/kafka_exporter_test.go @@ -18,9 +18,9 @@ import ( "go.opentelemetry.io/collector/pdata/plog" "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/pdata/ptrace" + "go.opentelemetry.io/collector/pdata/testdata" "go.uber.org/zap" - "github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/testdata" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/kafka" ) @@ -145,7 +145,7 @@ func TestTracesPusher(t *testing.T) { t.Cleanup(func() { require.NoError(t, p.Close(context.Background())) }) - err := p.tracesPusher(context.Background(), testdata.GenerateTracesTwoSpansSameResource()) + err := p.tracesPusher(context.Background(), testdata.GenerateTraces(2)) require.NoError(t, err) } @@ -163,7 +163,7 @@ func TestTracesPusher_err(t *testing.T) { t.Cleanup(func() { require.NoError(t, p.Close(context.Background())) }) - td := testdata.GenerateTracesTwoSpansSameResource() + td := testdata.GenerateTraces(2) err := p.tracesPusher(context.Background(), td) assert.EqualError(t, err, expErr.Error()) } @@ -174,7 +174,7 @@ func TestTracesPusher_marshal_error(t *testing.T) { marshaler: &tracesErrorMarshaler{err: expErr}, logger: zap.NewNop(), } - td := testdata.GenerateTracesTwoSpansSameResource() + td := testdata.GenerateTraces(2) err := p.tracesPusher(context.Background(), td) require.Error(t, err) assert.Contains(t, err.Error(), expErr.Error()) @@ -192,7 +192,7 @@ func TestMetricsDataPusher(t *testing.T) { t.Cleanup(func() { require.NoError(t, p.Close(context.Background())) }) - err := p.metricsDataPusher(context.Background(), testdata.GenerateMetricsTwoMetrics()) + err := p.metricsDataPusher(context.Background(), testdata.GenerateMetrics(2)) require.NoError(t, err) } @@ -210,7 +210,7 @@ func TestMetricsDataPusher_err(t *testing.T) { t.Cleanup(func() { require.NoError(t, p.Close(context.Background())) }) - md := testdata.GenerateMetricsTwoMetrics() + md := testdata.GenerateMetrics(2) err := p.metricsDataPusher(context.Background(), md) assert.EqualError(t, err, expErr.Error()) } @@ -221,7 +221,7 @@ func TestMetricsDataPusher_marshal_error(t *testing.T) { marshaler: &metricsErrorMarshaler{err: expErr}, logger: zap.NewNop(), } - md := testdata.GenerateMetricsTwoMetrics() + md := testdata.GenerateMetrics(2) err := p.metricsDataPusher(context.Background(), md) require.Error(t, err) assert.Contains(t, err.Error(), expErr.Error()) @@ -239,7 +239,7 @@ func TestLogsDataPusher(t *testing.T) { t.Cleanup(func() { require.NoError(t, p.Close(context.Background())) }) - err := p.logsDataPusher(context.Background(), testdata.GenerateLogsOneLogRecord()) + err := p.logsDataPusher(context.Background(), testdata.GenerateLogs(1)) require.NoError(t, err) } @@ -257,7 +257,7 @@ func TestLogsDataPusher_err(t *testing.T) { t.Cleanup(func() { require.NoError(t, p.Close(context.Background())) }) - ld := testdata.GenerateLogsOneLogRecord() + ld := testdata.GenerateLogs(1) err := p.logsDataPusher(context.Background(), ld) assert.EqualError(t, err, expErr.Error()) } @@ -268,7 +268,7 @@ func TestLogsDataPusher_marshal_error(t *testing.T) { marshaler: &logsErrorMarshaler{err: expErr}, logger: zap.NewNop(), } - ld := testdata.GenerateLogsOneLogRecord() + ld := testdata.GenerateLogs(1) err := p.logsDataPusher(context.Background(), ld) require.Error(t, err) assert.Contains(t, err.Error(), expErr.Error()) diff --git a/exporter/logicmonitorexporter/go.mod b/exporter/logicmonitorexporter/go.mod index 2f78d830bd2f..bfb7feeebdc5 100644 --- a/exporter/logicmonitorexporter/go.mod +++ b/exporter/logicmonitorexporter/go.mod @@ -4,7 +4,6 @@ go 1.21 require ( github.com/logicmonitor/lm-data-sdk-go v1.3.0 - github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.97.0 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.97.0 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/collector/component v0.97.1-0.20240409140257-792fac1b62d4 @@ -15,6 +14,7 @@ require ( go.opentelemetry.io/collector/consumer v0.97.1-0.20240409140257-792fac1b62d4 go.opentelemetry.io/collector/exporter v0.97.1-0.20240409140257-792fac1b62d4 go.opentelemetry.io/collector/pdata v1.4.1-0.20240409140257-792fac1b62d4 + go.opentelemetry.io/collector/pdata/testdata v0.0.0-20240408153657-fc289290613a go.opentelemetry.io/otel/metric v1.24.0 go.opentelemetry.io/otel/trace v1.24.0 go.uber.org/goleak v1.3.0 diff --git a/exporter/logicmonitorexporter/internal/traces/sender_test.go b/exporter/logicmonitorexporter/internal/traces/sender_test.go index 8b0a426c9ada..c9b07aafdf5f 100644 --- a/exporter/logicmonitorexporter/internal/traces/sender_test.go +++ b/exporter/logicmonitorexporter/internal/traces/sender_test.go @@ -14,9 +14,8 @@ import ( "github.com/logicmonitor/lm-data-sdk-go/utils" "github.com/stretchr/testify/assert" "go.opentelemetry.io/collector/consumer/consumererror" + "go.opentelemetry.io/collector/pdata/testdata" "go.uber.org/zap" - - "github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/testdata" ) func TestSendTraces(t *testing.T) { @@ -41,7 +40,7 @@ func TestSendTraces(t *testing.T) { sender, err := NewSender(ctx, ts.URL, ts.Client(), authParams, zap.NewNop()) assert.NoError(t, err) - err = sender.SendTraces(ctx, testdata.GenerateTracesOneSpan()) + err = sender.SendTraces(ctx, testdata.GenerateTraces(1)) cancel() assert.NoError(t, err) }) @@ -62,7 +61,7 @@ func TestSendTraces(t *testing.T) { sender, err := NewSender(ctx, ts.URL, ts.Client(), authParams, zap.NewNop()) assert.NoError(t, err) - err = sender.SendTraces(ctx, testdata.GenerateTracesOneSpan()) + err = sender.SendTraces(ctx, testdata.GenerateTraces(1)) cancel() assert.Error(t, err) assert.Equal(t, true, consumererror.IsPermanent(err)) @@ -84,7 +83,7 @@ func TestSendTraces(t *testing.T) { sender, err := NewSender(ctx, ts.URL, ts.Client(), authParams, zap.NewNop()) assert.NoError(t, err) - err = sender.SendTraces(ctx, testdata.GenerateTracesOneSpan()) + err = sender.SendTraces(ctx, testdata.GenerateTraces(1)) cancel() assert.Error(t, err) assert.Equal(t, false, consumererror.IsPermanent(err)) diff --git a/exporter/logzioexporter/exporter_test.go b/exporter/logzioexporter/exporter_test.go index 8c7dfb04f930..190afaa825c6 100644 --- a/exporter/logzioexporter/exporter_test.go +++ b/exporter/logzioexporter/exporter_test.go @@ -25,9 +25,8 @@ import ( "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/plog" "go.opentelemetry.io/collector/pdata/ptrace" + "go.opentelemetry.io/collector/pdata/testdata" conventions "go.opentelemetry.io/collector/semconv/v1.6.1" - - "github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/testdata" ) const ( @@ -90,7 +89,7 @@ func fillLogNoTimestamp(log plog.LogRecord) { } func generateLogsOneEmptyTimestamp() plog.Logs { - ld := testdata.GenerateLogsOneEmptyLogRecord() + ld := testdata.GenerateLogs(1) logs := ld.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords() ld.ResourceLogs().At(0).ScopeLogs().At(0).Scope().SetName("logScopeName") fillLogOne(logs.At(0)) @@ -195,7 +194,7 @@ func TestExportErrors(tester *testing.T) { }, } td := newTestTracesWithAttributes() - ld := testdata.GenerateLogsManyLogRecordsSameResource(10) + ld := testdata.GenerateLogs(10) err := testTracesExporter(td, tester, cfg) fmt.Println(err.Error()) require.Error(tester, err) @@ -283,7 +282,7 @@ func TestPushLogsData(tester *testing.T) { }, } defer server.Close() - ld := testdata.GenerateLogsManyLogRecordsSameResource(2) + ld := testdata.GenerateLogs(2) res := ld.ResourceLogs().At(0).Resource() res.Attributes().PutStr(conventions.AttributeServiceName, testService) res.Attributes().PutStr(conventions.AttributeHostName, testHost) diff --git a/exporter/logzioexporter/go.mod b/exporter/logzioexporter/go.mod index b6ff8a170602..e809b15ae95d 100644 --- a/exporter/logzioexporter/go.mod +++ b/exporter/logzioexporter/go.mod @@ -5,7 +5,6 @@ go 1.21 require ( github.com/hashicorp/go-hclog v1.6.3 github.com/jaegertracing/jaeger v1.55.0 - github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.97.0 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.97.0 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/collector/component v0.97.1-0.20240409140257-792fac1b62d4 @@ -17,6 +16,7 @@ require ( go.opentelemetry.io/collector/consumer v0.97.1-0.20240409140257-792fac1b62d4 go.opentelemetry.io/collector/exporter v0.97.1-0.20240409140257-792fac1b62d4 go.opentelemetry.io/collector/pdata v1.4.1-0.20240409140257-792fac1b62d4 + go.opentelemetry.io/collector/pdata/testdata v0.0.0-20240408153657-fc289290613a go.opentelemetry.io/collector/semconv v0.97.1-0.20240409140257-792fac1b62d4 go.opentelemetry.io/otel/metric v1.24.0 go.opentelemetry.io/otel/trace v1.24.0 @@ -54,6 +54,7 @@ require ( github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.97.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.1 // indirect diff --git a/exporter/opencensusexporter/go.mod b/exporter/opencensusexporter/go.mod index c4c19215e592..04f251265073 100644 --- a/exporter/opencensusexporter/go.mod +++ b/exporter/opencensusexporter/go.mod @@ -5,7 +5,6 @@ go 1.21 require ( github.com/census-instrumentation/opencensus-proto v0.4.1 github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.97.0 - github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.97.0 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/opencensus v0.97.0 github.com/open-telemetry/opentelemetry-collector-contrib/receiver/opencensusreceiver v0.97.0 github.com/stretchr/testify v1.9.0 @@ -18,6 +17,7 @@ require ( go.opentelemetry.io/collector/consumer v0.97.1-0.20240409140257-792fac1b62d4 go.opentelemetry.io/collector/exporter v0.97.1-0.20240409140257-792fac1b62d4 go.opentelemetry.io/collector/pdata v1.4.1-0.20240409140257-792fac1b62d4 + go.opentelemetry.io/collector/pdata/testdata v0.0.0-20240408153657-fc289290613a go.opentelemetry.io/collector/receiver v0.97.1-0.20240409140257-792fac1b62d4 go.opentelemetry.io/otel/metric v1.24.0 go.opentelemetry.io/otel/trace v1.24.0 @@ -51,6 +51,7 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mostynb/go-grpc-compression v1.2.2 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.97.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent v0.97.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_golang v1.19.0 // indirect diff --git a/exporter/opencensusexporter/opencensus_test.go b/exporter/opencensusexporter/opencensus_test.go index 5bc8001ef255..607ed49ca75c 100644 --- a/exporter/opencensusexporter/opencensus_test.go +++ b/exporter/opencensusexporter/opencensus_test.go @@ -16,10 +16,10 @@ import ( "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/exporter/exportertest" "go.opentelemetry.io/collector/pdata/ptrace" + "go.opentelemetry.io/collector/pdata/testdata" "go.opentelemetry.io/collector/receiver/receivertest" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/testutil" - "github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/testdata" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/opencensusreceiver" ) @@ -55,7 +55,7 @@ func TestSendTraces(t *testing.T) { assert.NoError(t, exp.Shutdown(context.Background())) }) - td := testdata.GenerateTracesOneSpan() + td := testdata.GenerateTraces(1) assert.NoError(t, exp.ConsumeTraces(context.Background(), td)) assert.Eventually(t, func() bool { return len(sink.AllTraces()) == 1 @@ -96,7 +96,7 @@ func TestSendTraces_NoBackend(t *testing.T) { assert.NoError(t, exp.Shutdown(context.Background())) }) - td := testdata.GenerateTracesOneSpan() + td := testdata.GenerateTraces(1) for i := 0; i < 10000; i++ { assert.Error(t, exp.ConsumeTraces(context.Background(), td)) } @@ -118,7 +118,7 @@ func TestSendTraces_AfterStop(t *testing.T) { require.NoError(t, exp.Start(context.Background(), host)) assert.NoError(t, exp.Shutdown(context.Background())) - td := testdata.GenerateTracesOneSpan() + td := testdata.GenerateTraces(1) assert.Error(t, exp.ConsumeTraces(context.Background(), td)) } @@ -154,7 +154,7 @@ func TestSendMetrics(t *testing.T) { assert.NoError(t, exp.Shutdown(context.Background())) }) - md := testdata.GenerateMetricsOneMetric() + md := testdata.GenerateMetrics(1) assert.NoError(t, exp.ConsumeMetrics(context.Background(), md)) assert.Eventually(t, func() bool { return len(sink.AllMetrics()) == 1 @@ -193,7 +193,7 @@ func TestSendMetrics_NoBackend(t *testing.T) { assert.NoError(t, exp.Shutdown(context.Background())) }) - md := testdata.GenerateMetricsOneMetric() + md := testdata.GenerateMetrics(1) for i := 0; i < 10000; i++ { assert.Error(t, exp.ConsumeMetrics(context.Background(), md)) } @@ -215,6 +215,6 @@ func TestSendMetrics_AfterStop(t *testing.T) { require.NoError(t, exp.Start(context.Background(), host)) assert.NoError(t, exp.Shutdown(context.Background())) - md := testdata.GenerateMetricsOneMetric() + md := testdata.GenerateMetrics(1) assert.Error(t, exp.ConsumeMetrics(context.Background(), md)) } diff --git a/receiver/kafkareceiver/go.mod b/receiver/kafkareceiver/go.mod index 8015cdafa32c..6ad31dfb951c 100644 --- a/receiver/kafkareceiver/go.mod +++ b/receiver/kafkareceiver/go.mod @@ -22,6 +22,7 @@ require ( go.opentelemetry.io/collector/confmap v0.97.1-0.20240409140257-792fac1b62d4 go.opentelemetry.io/collector/consumer v0.97.1-0.20240409140257-792fac1b62d4 go.opentelemetry.io/collector/pdata v1.4.1-0.20240409140257-792fac1b62d4 + go.opentelemetry.io/collector/pdata/testdata v0.0.0-20240408153657-fc289290613a go.opentelemetry.io/collector/receiver v0.97.1-0.20240409140257-792fac1b62d4 go.opentelemetry.io/collector/semconv v0.97.1-0.20240409140257-792fac1b62d4 go.opentelemetry.io/otel/metric v1.24.0 diff --git a/receiver/kafkareceiver/header_extraction_test.go b/receiver/kafkareceiver/header_extraction_test.go index c5219c219b55..709f56ee53ec 100644 --- a/receiver/kafkareceiver/header_extraction_test.go +++ b/receiver/kafkareceiver/header_extraction_test.go @@ -15,11 +15,10 @@ import ( "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/pdata/ptrace" + "go.opentelemetry.io/collector/pdata/testdata" "go.opentelemetry.io/collector/receiver/receiverhelper" "go.opentelemetry.io/collector/receiver/receivertest" "go.uber.org/zap/zaptest" - - "github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/testdata" ) func TestHeaderExtractionTraces(t *testing.T) { @@ -182,7 +181,7 @@ func TestHeaderExtractionMetrics(t *testing.T) { assert.NoError(t, err) wg.Done() }() - ld := testdata.GenerateMetricsOneMetric() + ld := testdata.GenerateMetrics(1) unmarshaler := &pmetric.ProtoMarshaler{} bts, err := unmarshaler.MarshalMetrics(ld) groupClaim.messageChan <- &sarama.ConsumerMessage{ diff --git a/receiver/kafkareceiver/kafka_receiver_test.go b/receiver/kafkareceiver/kafka_receiver_test.go index 89c151ccfabe..fbc49ecdf0cf 100644 --- a/receiver/kafkareceiver/kafka_receiver_test.go +++ b/receiver/kafkareceiver/kafka_receiver_test.go @@ -20,6 +20,7 @@ import ( "go.opentelemetry.io/collector/pdata/plog" "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/pdata/ptrace" + "go.opentelemetry.io/collector/pdata/testdata" "go.opentelemetry.io/collector/receiver/receiverhelper" "go.opentelemetry.io/collector/receiver/receivertest" "go.uber.org/zap" @@ -27,7 +28,6 @@ import ( "go.uber.org/zap/zaptest/observer" "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter" - "github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/testdata" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/textutils" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/kafka" ) @@ -544,7 +544,7 @@ func TestMetricsConsumerGroupHandler_error_nextConsumer(t *testing.T) { wg.Done() }() - ld := testdata.GenerateMetricsOneMetric() + ld := testdata.GenerateMetrics(1) unmarshaler := &pmetric.ProtoMarshaler{} bts, err := unmarshaler.MarshalMetrics(ld) require.NoError(t, err) @@ -811,7 +811,7 @@ func TestLogsConsumerGroupHandler_error_nextConsumer(t *testing.T) { wg.Done() }() - ld := testdata.GenerateLogsOneLogRecord() + ld := testdata.GenerateLogs(1) unmarshaler := &plog.ProtoMarshaler{} bts, err := unmarshaler.MarshalLogs(ld) require.NoError(t, err) diff --git a/receiver/opencensusreceiver/go.mod b/receiver/opencensusreceiver/go.mod index 487418c6b7d8..2a37960830c4 100644 --- a/receiver/opencensusreceiver/go.mod +++ b/receiver/opencensusreceiver/go.mod @@ -6,7 +6,6 @@ require ( github.com/census-instrumentation/opencensus-proto v0.4.1 github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.97.0 - github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.97.0 github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent v0.97.0 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/opencensus v0.97.0 github.com/rs/cors v1.10.1 @@ -19,6 +18,7 @@ require ( go.opentelemetry.io/collector/confmap v0.97.1-0.20240409140257-792fac1b62d4 go.opentelemetry.io/collector/consumer v0.97.1-0.20240409140257-792fac1b62d4 go.opentelemetry.io/collector/pdata v1.4.1-0.20240409140257-792fac1b62d4 + go.opentelemetry.io/collector/pdata/testdata v0.0.0-20240408153657-fc289290613a go.opentelemetry.io/collector/receiver v0.97.1-0.20240409140257-792fac1b62d4 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 go.opentelemetry.io/otel v1.24.0 @@ -54,6 +54,7 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mostynb/go-grpc-compression v1.2.2 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.97.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.1 // indirect diff --git a/receiver/opencensusreceiver/internal/ocmetrics/opencensus_test.go b/receiver/opencensusreceiver/internal/ocmetrics/opencensus_test.go index e9f14d1f002a..b44d5f5f4a2a 100644 --- a/receiver/opencensusreceiver/internal/ocmetrics/opencensus_test.go +++ b/receiver/opencensusreceiver/internal/ocmetrics/opencensus_test.go @@ -25,13 +25,13 @@ import ( "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/pdata/testdata" "go.opentelemetry.io/collector/receiver" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/timestamppb" - "github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/testdata" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/opencensus" ) @@ -52,7 +52,7 @@ func TestReceiver_endToEnd(t *testing.T) { metricsClient, metricsClientDoneFn, err := makeMetricsServiceClient(addr) require.NoError(t, err, "Failed to create the gRPC MetricsService_ExportClient: %v", err) defer metricsClientDoneFn() - md := testdata.GenerateMetricsOneMetric() + md := testdata.GenerateMetrics(1) node, resource, metrics := opencensus.ResourceMetricsToOC(md.ResourceMetrics().At(0)) assert.NoError(t, metricsClient.Send(&agentmetricspb.ExportMetricsServiceRequest{Node: node, Resource: resource, Metrics: metrics})) diff --git a/receiver/opencensusreceiver/internal/octrace/opencensus_test.go b/receiver/opencensusreceiver/internal/octrace/opencensus_test.go index f120b18fa819..460e8682d24f 100644 --- a/receiver/opencensusreceiver/internal/octrace/opencensus_test.go +++ b/receiver/opencensusreceiver/internal/octrace/opencensus_test.go @@ -23,13 +23,13 @@ import ( "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/pdata/testdata" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" "google.golang.org/protobuf/proto" - "github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/testdata" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/opencensus" ) @@ -48,7 +48,7 @@ func TestReceiver_endToEnd(t *testing.T) { traceClient, traceClientDoneFn, err := makeTraceServiceClient(addr) require.NoError(t, err, "Failed to create the gRPC TraceService_ExportClient: %v", err) defer traceClientDoneFn() - td := testdata.GenerateTracesOneSpan() + td := testdata.GenerateTraces(1) node, resource, spans := opencensus.ResourceSpansToOC(td.ResourceSpans().At(0)) assert.NoError(t, traceClient.Send(&agenttracepb.ExportTraceServiceRequest{Node: node, Resource: resource, Spans: spans})) diff --git a/receiver/otlpjsonfilereceiver/file_test.go b/receiver/otlpjsonfilereceiver/file_test.go index 731120679352..e985818e7331 100644 --- a/receiver/otlpjsonfilereceiver/file_test.go +++ b/receiver/otlpjsonfilereceiver/file_test.go @@ -19,9 +19,9 @@ import ( "go.opentelemetry.io/collector/pdata/plog" "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/pdata/ptrace" + "go.opentelemetry.io/collector/pdata/testdata" "go.opentelemetry.io/collector/receiver/receivertest" - "github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/testdata" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer/attrs" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer/matcher" @@ -47,7 +47,7 @@ func TestFileTracesReceiver(t *testing.T) { err = receiver.Start(context.Background(), nil) require.NoError(t, err) - td := testdata.GenerateTracesTwoSpansSameResource() + td := testdata.GenerateTraces(2) marshaler := &ptrace.JSONMarshaler{} b, err := marshaler.MarshalTraces(td) assert.NoError(t, err) @@ -74,7 +74,7 @@ func TestFileMetricsReceiver(t *testing.T) { err = receiver.Start(context.Background(), nil) assert.NoError(t, err) - md := testdata.GenerateMetricsManyMetricsSameResource(5) + md := testdata.GenerateMetrics(5) marshaler := &pmetric.JSONMarshaler{} b, err := marshaler.MarshalMetrics(md) assert.NoError(t, err) @@ -101,7 +101,7 @@ func TestFileLogsReceiver(t *testing.T) { err = receiver.Start(context.Background(), nil) assert.NoError(t, err) - ld := testdata.GenerateLogsManyLogRecordsSameResource(5) + ld := testdata.GenerateLogs(5) marshaler := &plog.JSONMarshaler{} b, err := marshaler.MarshalLogs(ld) assert.NoError(t, err) @@ -176,15 +176,15 @@ func TestFileMixedSignals(t *testing.T) { err = lr.Start(context.Background(), nil) assert.NoError(t, err) - md := testdata.GenerateMetricsManyMetricsSameResource(5) + md := testdata.GenerateMetrics(5) marshaler := &pmetric.JSONMarshaler{} b, err := marshaler.MarshalMetrics(md) assert.NoError(t, err) - td := testdata.GenerateTracesTwoSpansSameResource() + td := testdata.GenerateTraces(2) tmarshaler := &ptrace.JSONMarshaler{} b2, err := tmarshaler.MarshalTraces(td) assert.NoError(t, err) - ld := testdata.GenerateLogsManyLogRecordsSameResource(5) + ld := testdata.GenerateLogs(5) lmarshaler := &plog.JSONMarshaler{} b3, err := lmarshaler.MarshalLogs(ld) assert.NoError(t, err) diff --git a/receiver/otlpjsonfilereceiver/go.mod b/receiver/otlpjsonfilereceiver/go.mod index 61c892680a68..48cad69c08e9 100644 --- a/receiver/otlpjsonfilereceiver/go.mod +++ b/receiver/otlpjsonfilereceiver/go.mod @@ -3,13 +3,13 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/receiver/otlpjs go 1.21 require ( - github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.97.0 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza v0.97.0 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/collector/component v0.97.1-0.20240409140257-792fac1b62d4 go.opentelemetry.io/collector/confmap v0.97.1-0.20240409140257-792fac1b62d4 go.opentelemetry.io/collector/consumer v0.97.1-0.20240409140257-792fac1b62d4 go.opentelemetry.io/collector/pdata v1.4.1-0.20240409140257-792fac1b62d4 + go.opentelemetry.io/collector/pdata/testdata v0.0.0-20240408153657-fc289290613a go.opentelemetry.io/collector/receiver v0.97.1-0.20240409140257-792fac1b62d4 go.opentelemetry.io/otel/metric v1.24.0 go.opentelemetry.io/otel/trace v1.24.0 @@ -40,6 +40,7 @@ require ( github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.97.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.1 // indirect