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)
| 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. |
| 72 | func (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. |
no test coverage detected