Skip to main content

Module metrics

Module metrics 

Source
Expand description

PR-94: Prometheus /metrics endpoint + HTTP metrics middleware.

This module is a thin wrapper around ff_observability::Metrics. It compiles in both feature configurations:

  • observability offMetrics re-exports the no-op shim so call sites in api::router use an identical signature. The /metrics route is not mounted (see api::router) so serve is 404; the HTTP middleware is not installed.
  • observability on — real OTEL-backed registry, /metrics mounted, HTTP middleware installed that records ff_http_requests_total + ff_http_request_duration_seconds labelled by method + path (MatchedPath, so parameterized paths like /v1/executions/{id} collapse to one series) + status.

Structs§

Metrics
Zero-sized no-op registry. Identical public shape to the real implementation (see real.rs) so call sites don’t know which backend they’re hitting.

Functions§

http_middleware
Axum middleware: record HTTP method + MatchedPath + status + duration.
metrics_handler
GET /metrics — Prometheus text exposition (text/plain; version=0.0.4).