From 54ec88fb93b26e184c0a03c57249d1bc3bb0aa75 Mon Sep 17 00:00:00 2001 From: Travis Groth Date: Wed, 8 Dec 2021 16:13:08 -0500 Subject: [PATCH] internal/telemetry: fix grpc server stats (#2811) --- internal/telemetry/grpc.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/telemetry/grpc.go b/internal/telemetry/grpc.go index 592442795..54863838d 100644 --- a/internal/telemetry/grpc.go +++ b/internal/telemetry/grpc.go @@ -67,7 +67,9 @@ func (h *GRPCServerStatsHandler) TagRPC(ctx context.Context, tagInfo *grpcstats. trace.WithSpanKind(trace.SpanKindServer)) } - metricCtx := h.metricsHandler.TagRPC(ctx, tagInfo) + // ocgrpc's TagRPC must be called to attach the context rpcDataKey correctly + // https://github.com/census-instrumentation/opencensus-go/blob/bf52d9df8bb2d44cad934587ab946794456cf3c8/plugin/ocgrpc/server_stats_handler.go#L45 + metricCtx := h.metricsHandler.TagRPC(h.Handler.TagRPC(ctx, tagInfo), tagInfo) return metricCtx }