Skip to main content

Module span_propagation

Module span_propagation 

Source
Available on crate feature rpc only.
Expand description

Span context propagation for remote RPC calls

This module provides the SpanContextCarrier type for propagating trace context across remote boundaries. The type is always available when rpc feature is enabled, but actual OpenTelemetry integration requires the tracing-opentelemetry feature.

The propagated context is scoped to a single request handler via a tokio task-local, installed by the dispatch loop in handle_connection. This isolates concurrent requests from each other and is robust to thread migration across .await points.

Structs§

SpanContextCarrier
Carrier for propagating span context across RPC boundaries using W3C Trace Context format.

Functions§

scope_remote
Run fut with carrier’s context installed as the per-task scope read by set_span_parent_from_remote.
set_span_parent_from_remote
Set the parent of a span from the propagated remote context, if one is in scope.