Skip to main content

span

Function span 

Source
pub fn span<T>(
    name: &str,
    kind: &str,
    data: HashMap<String, Value>,
    f: impl FnOnce() -> T,
) -> T
Expand description

Times f as a child span of whatever span is open on this thread (or of the trace’s root), returning what f returned. Outside a trace it just runs f. Recorded even if f panics. kind is one of "controller", "service", "database", "redis", "http", "job", "other" (anything else is sent as "other").

let charged = forge_ops_tracker::span("charge card", "service", HashMap::new(), || charge(7));