MCPcopy
hub / github.com/grpc/grpc-go / HandleRPC

Method HandleRPC

stats/opentelemetry/client_tracing.go:138–155  ·  view source on GitHub ↗

HandleRPC handles per RPC tracing implementation.

(ctx context.Context, rs stats.RPCStats)

Source from the content-addressed store, hash-verified

136
137// HandleRPC handles per RPC tracing implementation.
138func (h *clientTracingHandler) HandleRPC(ctx context.Context, rs stats.RPCStats) {
139 ri := clientRPCInfo(ctx)
140 if ri == nil {
141 logger.Error("ctx passed into client side tracing handler trace event handling has no client attempt data present")
142 return
143 }
144
145 // Client-specific Begin attributes.
146 if begin, ok := rs.(*stats.Begin); ok {
147 ci := getCallInfo(ctx)
148 previousRPCAttempts := ci.previousRPCAttempts.Add(1) - 1
149 ri.ai.traceSpan.SetAttributes(
150 attribute.Int64("previous-rpc-attempts", int64(previousRPCAttempts)),
151 attribute.Bool("transparent-retry", begin.IsTransparentRetryAttempt),
152 )
153 }
154 populateSpan(rs, ri.ai)
155}

Callers

nothing calls this directly

Calls 5

clientRPCInfoFunction · 0.85
getCallInfoFunction · 0.85
populateSpanFunction · 0.70
ErrorMethod · 0.65
AddMethod · 0.65

Tested by

no test coverage detected