macro_rules! instrument_named {
($future:expr, $name:expr) => { ... };
($future:expr, $name:expr, $on_end:expr) => { ... };
}Expand description
Instruments a future with a named span.
Usage: instrument_named!(future, "span_name")
ยงExamples
use micromegas_tracing::prelude::*;
let future = async { 42 };
let result = instrument_named!(future, "operation_name").await;A trailing closure receives the output and a &mut SpanProperties to set end properties on:
use micromegas_tracing::prelude::*;
let rows = instrument_named!(async { vec![1, 2] }, "fetch", |rows, span| {
span.set_property("rows", rows.len());
})
.await;