collect_http_metrics

Function collect_http_metrics 

Source
pub async fn collect_http_metrics(
    matched_path: Option<MatchedPath>,
    req: Request,
    next: Next,
) -> Response
Expand description

Metrics collection middleware for HTTP requests

This middleware should be applied to all HTTP routes to collect comprehensive metrics for Prometheus. It tracks:

  • Total request counts (by method and status code)
  • Request duration (as histograms for percentile calculations)
  • In-flight requests
  • Error rates