[−][src]Function actori_tracing::trace
pub fn trace<S, U, F>(
service_factory: U,
make_span: F
) -> ApplyTransform<TracingTransform<S::Service, S, F>, S> where
S: ServiceFactory,
F: Fn(&S::Request) -> Option<Span> + Clone,
U: IntoServiceFactory<S>,
Wraps the provided service factory with a transform that automatically enters/exits the given span.
The span to be entered/exited can be provided via a closure. The closure is passed in a reference to the request being handled by the service.
For example:
ⓘThis example is not tested
let traced_service = trace( web_service, |req: &Request| Some(span!(Level::INFO, "request", req.id)) );