Skip to main content

Module http_metrics

Module http_metrics 

Source
Expand description

HTTP server metrics middleware (OpenTelemetry Semantic Conventions).

Records two instruments per request:

  • http.server.request.duration — histogram (seconds)
  • http.server.active_requests — up-down counter

Attributes follow OpenTelemetry HTTP semantic conventions: http.request.method, http.route, http.response.status_code.

Structs§

HttpMetrics
Holds the two OpenTelemetry instruments for HTTP server metrics.

Functions§

http_metrics_middleware
Axum middleware that records HTTP server metrics.
propagate_matched_path
Tiny route_layer that copies MatchedPath into response extensions so that outer layer() middleware (e.g. metrics) can read the route template.