Skip to main content

http_metrics_middleware

Function http_metrics_middleware 

Source
pub async fn http_metrics_middleware(
    __arg0: State<ApiMetricsHandle>,
    request: Request,
    next: Next,
) -> Response
Expand description

Axum middleware that records per-request HTTP metrics.

Apply via axum::middleware::from_fn_with_state(metrics, http_metrics_middleware).

Uses axum::extract::MatchedPath to capture the route template (e.g. /api/v1/tasks/{id}) instead of the raw URL — keeps path cardinality bounded.