pub fn trace<S, Req, I, F>(
service_factory: I,
make_span: F,
) -> ApplyTransform<TracingTransform<S::Service, S, F>, S, Req>
Expand description
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:
ⓘ
let traced_service = trace(
web_service,
|req: &Request| Some(span!(Level::INFO, "request", req.id))
);