Skip to main content

metrics_handler

Function metrics_handler 

Source
pub async fn metrics_handler(
    __arg0: State<Arc<MetricsRegistry>>,
) -> Result<impl IntoResponse, MetricsError>
Expand description

Handler for the /metrics endpoint.

Gathers from two registries: the local MetricsRegistry (HTTP request counters, protocol metrics, etc., wired by the observability layer) and prometheus::default_registry() (where mockforge-chaos registers its mockforge_chaos_* counters via register_counter_vec!). Without this merge, chaos counters were silently dropped from /metrics even when they were being incremented — issue #79 follow-up: Srikanth ran a bench that triggered 80 fault injections but curl /metrics | grep mockforge_chaos_ returned nothing because the two registries were disjoint.