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

Method finishTrace

stats/opentelemetry/client_tracing.go:72–80  ·  view source on GitHub ↗

finishTrace sets the span status based on the RPC result and ends the span. It is used to finalize tracing for both unary and streaming calls.

(err error, ts trace.Span)

Source from the content-addressed store, hash-verified

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.
72func (h *clientTracingHandler) finishTrace(err error, ts trace.Span) {
73 s := status.Convert(err)
74 if s.Code() == grpccodes.OK {
75 ts.SetStatus(otelcodes.Ok, s.Message())
76 } else {
77 ts.SetStatus(otelcodes.Error, s.Message())
78 }
79 ts.End()
80}
81
82// traceTagRPC populates provided context with a new span using the
83// TextMapPropagator supplied in trace options and internal itracing.carrier.

Callers 2

unaryInterceptorMethod · 0.95
streamInterceptorMethod · 0.95

Calls 3

ConvertFunction · 0.92
CodeMethod · 0.80
MessageMethod · 0.80

Tested by

no test coverage detected