MCPcopy
hub / github.com/opencloud-eu/opencloud / TraceContext

Function TraceContext

pkg/middleware/tracing.go:15–21  ·  view source on GitHub ↗

TraceContext unpacks the request context looking for an existing trace id.

(next http.Handler)

Source from the content-addressed store, hash-verified

13
14// TraceContext unpacks the request context looking for an existing trace id.
15func TraceContext(next http.Handler) http.Handler {
16 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
17 ctx := propagator.Extract(r.Context(), propagation.HeaderCarrier(r.Header))
18 propagator.Inject(ctx, propagation.HeaderCarrier(r.Header))
19 next.ServeHTTP(w, r.WithContext(ctx))
20 })
21}

Callers 1

ServeHTTPMethod · 0.92

Calls 2

ExtractMethod · 0.65
ServeHTTPMethod · 0.65

Tested by

no test coverage detected