pub struct MkSpanExecutor<E, F> { /* private fields */ }Available on crate feature
tracing only.Expand description
An executor that uses a callback to propagate tracing span to its futures.
The callback is invoked each time a future is spawned, creating a span that will be entered each time that future is polled or dropped. Execution is delegated to the wrapped executor, without requiring a particular runtime.
Requires the tracing feature.
§Example
Spawned tasks can be marked as “following from” the execution context.
See tracing::Span::follows_from() for more information about
indicating causal relationships between spans.
use hyper_util::rt::{MkSpanExecutor, TokioExecutor};
use tracing::{info_span, Span};
let mk = || {
let span = info_span!("example");
span.follows_from(Span::current());
span
};
let executor = MkSpanExecutor::new(TokioExecutor::new(), mk);Spawned tasks can be marked as children of the execution context.
use hyper_util::rt::{MkSpanExecutor, TokioExecutor};
use tracing::{info_span, Span};
let mk = || info_span!(parent: Span::current(), "example");
let executor = MkSpanExecutor::new(TokioExecutor::new(), mk);Implementations§
Source§impl<E, F> MkSpanExecutor<E, F>
impl<E, F> MkSpanExecutor<E, F>
Trait Implementations§
Auto Trait Implementations§
impl<E, F> Freeze for MkSpanExecutor<E, F>
impl<E, F> RefUnwindSafe for MkSpanExecutor<E, F>where
E: RefUnwindSafe,
F: RefUnwindSafe,
impl<E, F> Send for MkSpanExecutor<E, F>
impl<E, F> Sync for MkSpanExecutor<E, F>
impl<E, F> Unpin for MkSpanExecutor<E, F>
impl<E, F> UnsafeUnpin for MkSpanExecutor<E, F>where
E: UnsafeUnpin,
F: UnsafeUnpin,
impl<E, F> UnwindSafe for MkSpanExecutor<E, F>where
E: UnwindSafe,
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more