pub trait InstrumentFuture: Sized + Future {
// Provided methods
fn instrument(
self,
span_desc: &'static SpanMetadata,
) -> InstrumentedFuture<Self> ⓘ { ... }
fn instrument_with<H>(
self,
span_desc: &'static SpanMetadata,
on_end: H,
) -> InstrumentedFuture<Self, H> ⓘ
where H: FnOnce(&Self::Output, &mut SpanProperties) { ... }
}Expand description
Trait for adding instrumentation to futures
Provided Methods§
Sourcefn instrument(
self,
span_desc: &'static SpanMetadata,
) -> InstrumentedFuture<Self> ⓘ
fn instrument( self, span_desc: &'static SpanMetadata, ) -> InstrumentedFuture<Self> ⓘ
Instrument this future with the given span metadata
Sourcefn instrument_with<H>(
self,
span_desc: &'static SpanMetadata,
on_end: H,
) -> InstrumentedFuture<Self, H> ⓘ
fn instrument_with<H>( self, span_desc: &'static SpanMetadata, on_end: H, ) -> InstrumentedFuture<Self, H> ⓘ
Instruments this future, and lets on_end add properties to the end event from the
output. A hook that sets nothing leaves the plain end event.
use micromegas_tracing::prelude::*;
use micromegas_tracing::spans::InstrumentFuture as _;
static_span_desc!(FETCH, "fetch");
let rows = async { vec![1, 2, 3] }
.instrument_with(&FETCH, |rows, span| span.set_property("rows", rows.len()))
.await;Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".