macro_rules! span_scope {
(name = $name:expr $(, $($rest:tt)*)?) => { ... };
($static_var_name:ident, $name:expr) => { ... };
($name:expr) => { ... };
}Expand description
Records a sync span as two thread events
§Examples
use micromegas_tracing::span_scope;
span_scope!("scope");With name =, the macro is an expression that returns the guard, and the span’s end event
carries the properties. The list is the one log! takes (literals, static values, %, ?
and bare values, and a trailing ..set); name is reserved for the span’s name. Add results
later with set_property, which wins over a property of the same name given here.
use micromegas_tracing::prelude::*;
let request = 7;
let mut span = span_scope!(name = "fetch_rows", region = "eu", request = %request);
span.set_property("rows", 42);Bind the guard to a name: let _ = span_scope!(name = ..) drops it at once, like any
let _. A bare statement is a compile error under deny(unused_must_use):
ⓘ
#![deny(unused_must_use)]
use micromegas_tracing::span_scope;
span_scope!(name = "x");name can’t also be a property key:
ⓘ
use micromegas_tracing::span_scope;
let _span = span_scope!(name = "x", name = "y");