Skip to main content

continue_trace

Function continue_trace 

Source
pub fn continue_trace<T>(
    root_name: &str,
    traceparent: Option<&str>,
    f: impl FnOnce() -> T,
) -> T
Expand description

The same as trace, continuing the caller’s trace when traceparent is a usable W3C traceparent header value, typically the incoming request’s own header: the trace keeps the caller’s trace id, and its root span records the caller’s span as its parent, so it nests under that span on ForgeOps. None, blank, or malformed starts a fresh trace, exactly like trace. Ignored inside an already-open trace.

// `incoming` is the request's own "traceparent" header, however your server exposes it.
let status = forge_ops_tracker::continue_trace("POST /orders", incoming.as_deref(), || {
    handle_request()
});