get_trace_id

Function get_trace_id 

Source
pub fn get_trace_id() -> TraceId
Expand description

Fetches the current opentelemetry::trace::TraceId as a hexadecimal string.

This function retrieves the TraceId by traversing the full tracing stack, from the current tracing::Span to its corresponding opentelemetry::Context. It returns the trace ID associated with the current span.

ยงExample

let trace_id = get_trace_id();
println!("Current trace ID: {:?}", trace_id);