Skip to main content

metrics_handle

Function metrics_handle 

Source
pub fn metrics_handle() -> &'static PrometheusHandle
Expand description

Get the Prometheus handle for rendering metrics.

Initializes on first use as a backstop rather than requiring a prior init call. /metrics is registered unconditionally by server::start_server, which embedded hosts (including SDK consumers) reach without going through a binary’s startup path — so requiring explicit initialization here made that route abort its request thread for every embedder.

This guarantees /metrics never panics, but it is not the intended install point: see init for why the recorder must be installed at boot rather than on the first scrape.