Function warp::filters::trace::named

source ·
pub fn named(name: &'static str) -> Trace<impl Fn(Info<'_>) -> Span + Copy>
Expand description

Create a wrapping filter that instruments every request with a tracing Span at the DEBUG level representing a named context.

This can be used to instrument multiple routes with their own sub-spans in a per-request trace.

§Example

use warp::Filter;

let hello = warp::path("hello")
    .map(warp::reply)
    .with(warp::trace::named("hello"));

let goodbye = warp::path("goodbye")
    .map(warp::reply)
    .with(warp::trace::named("goodbye"));

let routes = hello.or(goodbye);