diff --git a/systemtest/cmd/sendotlp/main.go b/systemtest/cmd/sendotlp/main.go index 6825343bcc1..143b1d0c045 100644 --- a/systemtest/cmd/sendotlp/main.go +++ b/systemtest/cmd/sendotlp/main.go @@ -31,6 +31,7 @@ import ( "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/plog" "go.opentelemetry.io/collector/pdata/plog/plogotlp" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" "go.opentelemetry.io/otel/exporters/otlp/otlptrace" @@ -38,6 +39,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp" "go.opentelemetry.io/otel/metric" sdkmetric "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" semconv "go.opentelemetry.io/otel/semconv/v1.8.0" "go.opentelemetry.io/otel/trace" @@ -137,7 +139,10 @@ func Main(ctx context.Context, logger *zap.SugaredLogger) (result error) { if err != nil { return err } - tracerProvider := sdktrace.NewTracerProvider(sdktrace.WithSyncer(otlpExporters.trace)) + tracerProvider := sdktrace.NewTracerProvider( + sdktrace.WithSyncer(otlpExporters.trace), + sdktrace.WithResource(getCommonResource()), + ) defer func() { if err := tracerProvider.Shutdown(ctx); err != nil { result = errors.Join(result, @@ -184,6 +189,14 @@ func Main(ctx context.Context, logger *zap.SugaredLogger) (result error) { return nil } +func getCommonResource() *resource.Resource { + return resource.NewWithAttributes( + semconv.SchemaURL, + attribute.StringSlice("testfix", []string{"test1", "test2"}), + attribute.IntSlice("testfixnum", []int{20, 40, 60}), + ) +} + func generateSpans(ctx context.Context, tracer trace.Tracer) error { ctx, parent := tracer.Start(ctx, "parent") defer parent.End()