From c5397f07bdf4ee61a63d97395542e521a00101f8 Mon Sep 17 00:00:00 2001 From: Joel Hendrix Date: Mon, 5 Jun 2023 14:44:57 -0700 Subject: [PATCH 1/2] Set telemetry schema on tracers Document the version in use. --- sdk/tracing/azotel/go.sum | 2 -- sdk/tracing/azotel/otel.go | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sdk/tracing/azotel/go.sum b/sdk/tracing/azotel/go.sum index 79b4626fc7c3..96ffd19b2f0e 100644 --- a/sdk/tracing/azotel/go.sum +++ b/sdk/tracing/azotel/go.sum @@ -1,5 +1,3 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0-beta.1 h1:TpBJ3UP3Vx9OBk1nP/5FynUmQXPeIq2RXadb4gq8ZgU= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0-beta.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0/go.mod h1:OQeznEEkTZ9OrhHJoDD8ZDq51FHgXjqtP9z6bEwBq9U= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= diff --git a/sdk/tracing/azotel/otel.go b/sdk/tracing/azotel/otel.go index 9038d1743153..9b64565b6f68 100644 --- a/sdk/tracing/azotel/otel.go +++ b/sdk/tracing/azotel/otel.go @@ -15,6 +15,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" otelsdk "go.opentelemetry.io/otel/sdk/trace" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.opentelemetry.io/otel/trace" ) @@ -24,11 +25,13 @@ type TracingProviderOptions struct { } // NewTracingProvider creates a new tracing.Provider that wraps the specified OpenTelemetry TracerProvider. +// The telemetry schema for trace.Tracers created from tracerProvider is set to v1.17.0. Therefore, any attributes +// set on the tracerProvider must be compatible with the v1.17.0 telemetry schema. // - tracerProvider - the TracerProvider to wrap // - opts - optional configuration. pass nil to accept the default values func NewTracingProvider(tracerProvider *otelsdk.TracerProvider, opts *TracingProviderOptions) tracing.Provider { return tracing.NewProvider(func(namespace, version string) tracing.Tracer { - tracer := tracerProvider.Tracer(namespace, trace.WithInstrumentationVersion(version)) + tracer := tracerProvider.Tracer(namespace, trace.WithInstrumentationVersion(version), trace.WithSchemaURL(semconv.SchemaURL)) return tracing.NewTracer(func(ctx context.Context, spanName string, options *tracing.SpanOptions) (context.Context, tracing.Span) { kind := tracing.SpanKindInternal From aef038154ee91b823bdd68de2671adab39f3a803 Mon Sep 17 00:00:00 2001 From: Joel Hendrix Date: Tue, 6 Jun 2023 07:32:46 -0700 Subject: [PATCH 2/2] remove unnecessary doc comment use string for version for now --- sdk/tracing/azotel/otel.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sdk/tracing/azotel/otel.go b/sdk/tracing/azotel/otel.go index 9b64565b6f68..898adbc519ee 100644 --- a/sdk/tracing/azotel/otel.go +++ b/sdk/tracing/azotel/otel.go @@ -15,7 +15,6 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" otelsdk "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.opentelemetry.io/otel/trace" ) @@ -25,13 +24,11 @@ type TracingProviderOptions struct { } // NewTracingProvider creates a new tracing.Provider that wraps the specified OpenTelemetry TracerProvider. -// The telemetry schema for trace.Tracers created from tracerProvider is set to v1.17.0. Therefore, any attributes -// set on the tracerProvider must be compatible with the v1.17.0 telemetry schema. // - tracerProvider - the TracerProvider to wrap // - opts - optional configuration. pass nil to accept the default values func NewTracingProvider(tracerProvider *otelsdk.TracerProvider, opts *TracingProviderOptions) tracing.Provider { return tracing.NewProvider(func(namespace, version string) tracing.Tracer { - tracer := tracerProvider.Tracer(namespace, trace.WithInstrumentationVersion(version), trace.WithSchemaURL(semconv.SchemaURL)) + tracer := tracerProvider.Tracer(namespace, trace.WithInstrumentationVersion(version), trace.WithSchemaURL("https://opentelemetry.io/schemas/1.17.0")) return tracing.NewTracer(func(ctx context.Context, spanName string, options *tracing.SpanOptions) (context.Context, tracing.Span) { kind := tracing.SpanKindInternal