pub fn trace_layer_with_propagation() -> TraceLayer<SharedClassifier<ServerErrorsAsFailures>, impl Fn(&Request<Body>) -> Span + Clone>Expand description
Returns a TraceLayer that, in addition to the per-request span,
reads the W3C traceparent header from the incoming request and uses
it as the parent context for the resulting span.
When a downstream service (or load test client) sends the W3C standard header, traces stitch correctly across the boundary. When no header is present, the span is parented to the local context as usual.
The function delegates the actual parsing to the OpenTelemetry global
TextMapPropagator. crate::server::build_router_with_audit calls
crate::trace_propagation::install_w3c_propagator before any
request can hit this layer, so the parsing path is reliably wired
regardless of whether the otlp feature is enabled on
tensor-wasm-core. If for some reason no propagator is installed —
e.g. in a test that bypasses the server builder — the extraction
returns an empty context and the span is parented locally.