pub trait InstrumentStreamwhere
Self: Stream + Sized,{
// Required methods
fn instrument(self, _: Span) -> Instrumented<Self>;
fn instrument_with<S>(self, _: S) -> WithInstrumented<Self, S>
where S: FnMut() -> Span;
}
Expand description
Extension trait allowing [futures::Stream
]s to be instrumented with a [tracing::Span
].
Required Methods§
sourcefn instrument(self, _: Span) -> Instrumented<Self>
fn instrument(self, _: Span) -> Instrumented<Self>
Instruments the stream with the given span. Alias for
tracing_futures::Instrument::instrument
.
The span will be entered and exited every time the stream is polled. The span will be closed only when the stream is dropped.
If the stream is long-lived, consider InstrumentStream::instrument_with
instead to
avoid accumulating too many events in the span.
sourcefn instrument_with<S>(self, _: S) -> WithInstrumented<Self, S>where
S: FnMut() -> Span,
fn instrument_with<S>(self, _: S) -> WithInstrumented<Self, S>where
S: FnMut() -> Span,
Instruments the stream with spans created by the given closure every time an item is yielded.
Object Safety§
This trait is not object safe.