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

Method streamInterceptor

stats/opentelemetry/client_tracing.go:60–68  ·  view source on GitHub ↗
(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption)

Source from the content-addressed store, hash-verified

58}
59
60func (h *clientTracingHandler) streamInterceptor(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) {
61 ctx, _ = getOrCreateCallInfo(ctx, cc, method, opts...)
62
63 var span trace.Span
64 ctx, span = h.createCallTraceSpan(ctx, method)
65 callback := func(err error) { h.finishTrace(err, span) }
66 opts = append([]grpc.CallOption{grpc.OnFinish(callback)}, opts...)
67 return streamer(ctx, desc, cc, method, opts...)
68}
69
70// finishTrace sets the span status based on the RPC result and ends the span.
71// It is used to finalize tracing for both unary and streaming calls.

Callers

nothing calls this directly

Calls 4

createCallTraceSpanMethod · 0.95
finishTraceMethod · 0.95
OnFinishFunction · 0.92
getOrCreateCallInfoFunction · 0.85

Tested by

no test coverage detected