Skip to main content

request_id_middleware

Function request_id_middleware 

Source
pub async fn request_id_middleware(
    req: Request<Body>,
    next: Next,
) -> Response<Body>
Expand description

Add or generate request ID, attach a request span carrying its short form, and store the full id in extensions. The custom log formatter (crate::log::CloudilloFormat) uses the request span’s id field to prefix every event line with REQ:<short>.

If the outer transport layer (see cloudillo::webserver::create_https_server) has already inserted a RequestId extension and entered the request span, RequestId::install returns a span that just re-uses the existing id.