Skip to content

Commit

Permalink
[instrumentation/google.golang.org/grpc/otelgrpc] Add safeguard to Ha…
Browse files Browse the repository at this point in the history
  • Loading branch information
mx-psi committed Jan 17, 2024
1 parent 96790b3 commit bbff530
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ func (h *clientHandler) HandleConn(context.Context, stats.ConnStats) {
func (c *config) handleRPC(ctx context.Context, rs stats.RPCStats, isServer bool) { // nolint: revive // isServer is not a control flag.
span := trace.SpanFromContext(ctx)
gctx, _ := ctx.Value(gRPCContextKey{}).(*gRPCContext)
if gctx == nil {
// Shouldn't happen because TagRPC populates this information.
return
}
var messageId int64
metricAttrs := make([]attribute.KeyValue, 0, len(gctx.metricAttrs)+1)
metricAttrs = append(metricAttrs, gctx.metricAttrs...)
Expand Down

0 comments on commit bbff530

Please sign in to comment.