Skip to main content

current_trace_context

Function current_trace_context 

Source
pub fn current_trace_context() -> TraceContext
Expand description

Return the current trace context, or an empty context when none is active.

With the otel feature enabled, this reads the opentelemetry SpanContext bridged onto the current tracing span by a tracing-opentelemetry layer. It returns an empty context (no leak) when the feature is off, no such layer is installed, or the current span has no valid context. The OTLP exporter pipeline is orthogonal — installing a layer is enough; an exporter is not required.