Expand description
W3C traceparent propagation across the connectrpc boundary.
Pairs with crate::observability::init (which installs the global
TraceContextPropagator).
Together they close the OTel cross-process story: a turn started on the
control plane carries its trace context into the harness’s connect span,
so a single user request stitches into one trace tree across the
control-plane → harness hop.
§Direction
- Outgoing:
inject_current_span_intowrites the currenttracing::Span’sOTelcontext into anhttp::HeaderMapusing the globally-installed propagator. Callers attach the headers to aconnectrpc::client::CallOptions(per-call) orconnectrpc::client::ClientConfig(per-client default). - Incoming:
extract_parent_into_current_spanreadstraceparent(and any other propagator-registered fields) off a borrowedhttp::HeaderMapand re-parents the currenttracing::Spanso the server-side span shares the dialer’s trace id.
§Design
The Injector/Extractor adapters are intentionally trivial — they
exist because opentelemetry’s trait surface is carrier-agnostic and
http::HeaderMap is not. Keeping them in polyc-runtime means the
control plane, the harness, and any future server share one implementation;
per-call sites only pick which side (inject vs extract) they need.
Structs§
- Http
Header Extractor - Adapter that lets the global
OTelpropagator readtraceparent(and any other fields) off anhttp::HeaderMap. - Http
Header Injector - Adapter that injects propagator fields into an
http::HeaderMap.
Functions§
- extract_
context_ from - Extract a parent
Contextfromheadersusing the globally-installed propagator. Lower-level thanextract_parent_into_current_span. - extract_
parent_ into_ current_ span - Extract the parent
OTelcontext fromheadersand attach it to the currenttracing::Span, so server-side spans share the dialer’s trace id. - inject_
context_ into - Inject a specific
Contextintoheaders. Lower-level thaninject_current_span_into; prefer that for production call sites. - inject_
current_ span_ into - Inject the current
tracing::Span’sOTelcontext intoheaders.