diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go b/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go index d421e95945f..34048605d54 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go @@ -375,13 +375,13 @@ func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor { grpcStatusCode = s.Code() statusCode, msg := serverStatus(s) span.SetStatus(statusCode, msg) - span.SetAttributes(statusCodeAttr(s.Code())) + span.SetAttributes(statusCodeAttr(grpcStatusCode)) if cfg.SentEvent { messageSent.Event(ctx, 1, s.Proto()) } } else { grpcStatusCode = grpc_codes.OK - span.SetAttributes(statusCodeAttr(grpc_codes.OK)) + span.SetAttributes(statusCodeAttr(grpcStatusCode)) if cfg.SentEvent { messageSent.Event(ctx, 1, resp) }