Skip to main content

init

Function init 

Source
pub fn init()
Expand description

Initialize the Prometheus metrics exporter.

Idempotent: the recorder is installed at most once per process, so callers need not coordinate. server::start_server calls this at boot, and the binaries call it earlier still to fix ordering relative to other telemetry setup.

Call this before recording any metric. The metrics macros resolve the global recorder on every call and silently discard writes to a no-op when none is installed, so metrics recorded before this point are lost — which is why installation cannot be left to metrics_handle’s lazy path alone.