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

Method unaryInterceptor

stats/opentelemetry/client_tracing.go:50–58  ·  view source on GitHub ↗
(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption)

Source from the content-addressed store, hash-verified

48}
49
50func (h *clientTracingHandler) unaryInterceptor(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {
51 ctx, _ = getOrCreateCallInfo(ctx, cc, method, opts...)
52
53 var span trace.Span
54 ctx, span = h.createCallTraceSpan(ctx, method)
55 err := invoker(ctx, method, req, reply, cc, opts...)
56 h.finishTrace(err, span)
57 return err
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...)

Callers

nothing calls this directly

Calls 3

createCallTraceSpanMethod · 0.95
finishTraceMethod · 0.95
getOrCreateCallInfoFunction · 0.85

Tested by

no test coverage detected