Skip to main content

trace

Function trace 

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

Runs f as a trace named root_name (for example "GET /checkout" or "job:reindex"): every span and record_span inside it, on this thread, nests beneath this root. When f took at least Configuration.trace_capture_threshold (1 second by default) the whole trace is sent to ForgeOps, so fast calls cost nothing on the wire. Sent even if f panics. Called inside an already-open trace it just records a span instead.

This crate has no web framework integration, so nothing starts a trace automatically: wrap whatever you want traced, typically a request handler or a background job.

let status = forge_ops_tracker::trace("GET /checkout", || handle_request());