contextWithTraceParent returns a new context with trace context extracted from the provided W3C traceparent and tracestate headers.
(ctx context.Context, traceparent, tracestate string)
| 18 | // contextWithTraceParent returns a new context with trace context extracted from |
| 19 | // the provided W3C traceparent and tracestate headers. |
| 20 | func contextWithTraceParent(ctx context.Context, traceparent, tracestate string) context.Context { |
| 21 | if traceparent == "" { |
| 22 | return ctx |
| 23 | } |
| 24 | carrier := propagation.MapCarrier{ |
| 25 | "traceparent": traceparent, |
| 26 | } |
| 27 | if tracestate != "" { |
| 28 | carrier["tracestate"] = tracestate |
| 29 | } |
| 30 | return otel.GetTextMapPropagator().Extract(ctx, carrier) |
| 31 | } |
no outgoing calls
searching dependent graphs…