Checklist
Description
The HTTP gateway should support propagation of trace context headers using the W3C Trace Context recommendation.
This consists of supporting two optional HTTP headers traceparent and tracestate on incoming requests, adopting the trace id from the traceparent header for internal traces and emitting updated or new headers on responses.
This will allow:
- people using the gateway as a component in their infrastructure to correlate traces that pass through it
- gateway providers to trace incoming requests and correlate with logs
- performance optimizers to correlate traces with experiments
Of particular use will be the "sampled" flag on the emitted traceparent header that indicates whether the request was sampled for tracing by Kubo.
Implementation Note
This should be as simple as using the opentelemetry TraceContext, roughly:
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
p := propagation.TraceContext{}
ctx := p.Extract(r.Context(), propagation.HeaderCarrier(r.Header))
// do stuff
p.Inject(ctx, propagation.HeaderCarrier(w.Header()))
}
Checklist
Description
The HTTP gateway should support propagation of trace context headers using the W3C Trace Context recommendation.
This consists of supporting two optional HTTP headers
traceparentandtracestateon incoming requests, adopting the trace id from thetraceparentheader for internal traces and emitting updated or new headers on responses.This will allow:
Of particular use will be the "sampled" flag on the emitted
traceparentheader that indicates whether the request was sampled for tracing by Kubo.Implementation Note
This should be as simple as using the opentelemetry TraceContext, roughly: