From 62861040b362583d9b7a910bd319880d9979c0b1 Mon Sep 17 00:00:00 2001 From: Umut Tezduyar Lidskog Date: Tue, 7 Nov 2023 13:18:11 +0100 Subject: [PATCH] Revert "remove grp changes to find why compat tests are failing" This reverts commit bb8ac0ca9d701dcd772ecfa0d29c75b86fce558d. --- instrumentation/google.golang.org/grpc/otelgrpc/config.go | 8 ++++---- .../google.golang.org/grpc/otelgrpc/interceptor.go | 8 ++++---- .../google.golang.org/grpc/otelgrpc/test/grpc_test.go | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/config.go b/instrumentation/google.golang.org/grpc/otelgrpc/config.go index bad05b6734f..494465dc66a 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/config.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/config.go @@ -24,8 +24,8 @@ import ( ) const ( - // instrumentationName is the name of this instrumentation package. - instrumentationName = "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" + // ScopeName is the instrumentation scope name. + ScopeName = "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" // GRPCStatusCodeKey is convention for numeric status code of a gRPC request. GRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") ) @@ -73,12 +73,12 @@ func newConfig(opts []Option, role string) *config { } c.tracer = c.TracerProvider.Tracer( - instrumentationName, + ScopeName, trace.WithInstrumentationVersion(SemVersion()), ) c.meter = c.MeterProvider.Meter( - instrumentationName, + ScopeName, metric.WithInstrumentationVersion(Version()), metric.WithSchemaURL(semconv.SchemaURL), ) diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go b/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go index c737d29dcd0..8ff583f0608 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go @@ -63,7 +63,7 @@ var ( func UnaryClientInterceptor(opts ...Option) grpc.UnaryClientInterceptor { cfg := newConfig(opts, "client") tracer := cfg.TracerProvider.Tracer( - instrumentationName, + ScopeName, trace.WithInstrumentationVersion(Version()), ) @@ -257,7 +257,7 @@ func (w *clientStream) sendStreamEvent(eventType streamEventType, err error) { func StreamClientInterceptor(opts ...Option) grpc.StreamClientInterceptor { cfg := newConfig(opts, "client") tracer := cfg.TracerProvider.Tracer( - instrumentationName, + ScopeName, trace.WithInstrumentationVersion(Version()), ) @@ -327,7 +327,7 @@ func StreamClientInterceptor(opts ...Option) grpc.StreamClientInterceptor { func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor { cfg := newConfig(opts, "server") tracer := cfg.TracerProvider.Tracer( - instrumentationName, + ScopeName, trace.WithInstrumentationVersion(Version()), ) @@ -448,7 +448,7 @@ func wrapServerStream(ctx context.Context, ss grpc.ServerStream, cfg *config) *s func StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor { cfg := newConfig(opts, "server") tracer := cfg.TracerProvider.Tracer( - instrumentationName, + ScopeName, trace.WithInstrumentationVersion(Version()), ) diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/test/grpc_test.go b/instrumentation/google.golang.org/grpc/otelgrpc/test/grpc_test.go index 6d8a82676ba..aa52b93bee4 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/test/grpc_test.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/test/grpc_test.go @@ -40,7 +40,7 @@ import ( ) var wantInstrumentationScope = instrumentation.Scope{ - Name: "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc", + Name: otelgrpc.ScopeName, SchemaURL: "https://opentelemetry.io/schemas/1.17.0", Version: otelgrpc.Version(), }