MCPcopy Index your code
hub / github.com/github/copilot-sdk / contextWithTraceParent

Function contextWithTraceParent

go/telemetry.go:20–31  ·  view source on GitHub ↗

contextWithTraceParent returns a new context with trace context extracted from the provided W3C traceparent and tracestate headers.

(ctx context.Context, traceparent, tracestate string)

Source from the content-addressed store, hash-verified

18// contextWithTraceParent returns a new context with trace context extracted from
19// the provided W3C traceparent and tracestate headers.
20func 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}

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…