metrics_middleware

Function metrics_middleware 

Source
pub async fn metrics_middleware(
    __arg0: State<Arc<MetricsState>>,
    req: Request,
    next: Next,
) -> Response
Expand description

Metrics middleware that records HTTP request metrics.

Records the following metrics:

  • http_requests_total: Total number of HTTP requests (counter)
  • http_request_duration_seconds: Request duration (gauge)
  • http_errors_total: Total number of error responses (counter)