pub fn current_trace_id() -> Option<String>Expand description
Return the 32-character lowercase hex representation of the active span’s trace id, if any.
The value is read from tracing::Span::current() via the
tracing_opentelemetry::OpenTelemetrySpanExt bridge, which only
resolves to a non-zero id when a tracing_opentelemetry layer is
active in the subscriber. Returns None when no layer is installed
(the common case in unit tests that do not initialise telemetry) or
when the active span has no associated OTel context.
The “invalid” all-zero trace id (00000000000000000000000000000000)
returned by SpanContext::INVALID is also mapped to None so callers
can branch on Option instead of pattern-matching on the sentinel.