getTraceContext extracts the current W3C Trace Context (traceparent/tracestate) from the Go context using the global OTel propagator.
(ctx context.Context)
| 10 | // getTraceContext extracts the current W3C Trace Context (traceparent/tracestate) |
| 11 | // from the Go context using the global OTel propagator. |
| 12 | func getTraceContext(ctx context.Context) (traceparent, tracestate string) { |
| 13 | carrier := propagation.MapCarrier{} |
| 14 | otel.GetTextMapPropagator().Inject(ctx, carrier) |
| 15 | return carrier.Get("traceparent"), carrier.Get("tracestate") |
| 16 | } |
| 17 | |
| 18 | // contextWithTraceParent returns a new context with trace context extracted from |
| 19 | // the provided W3C traceparent and tracestate headers. |
searching dependent graphs…