Skip to main content

router_with_metrics

Function router_with_metrics 

Source
pub fn router_with_metrics(
    server: Arc<Server>,
    cors_origins: &[String],
    api_token: Option<String>,
    metrics: Option<Arc<Metrics>>,
) -> Result<Router, ConfigError>
Expand description

Router entry point that also mounts /metrics and the HTTP metrics middleware. Used by main.rs when the observability feature is on.

When metrics is Some AND the observability feature is compiled in, /metrics is mounted on an un-authenticated nested router (auth middleware does not apply — Prometheus convention). When the feature is off OR metrics is None, no /metrics route exists (returns 404) and no HTTP metrics middleware is installed.