Skip to main content

install

Function install 

Source
pub fn install(
    settings: &MetricsSettings,
) -> Result<MetricsHandle, MetricsError>
Expand description

Install the configured exporter as this process’s global recorder and return the handle the admin server renders from.

Call this before constructing any metric handle structs (SinkShardMetrics and friends): handles bind to the recorder present at construction, and handles built earlier record into the void. Idempotent — a second call returns the first call’s handle (with a warning when the requested settings differ). MetricsError::AlreadyInstalled is only returned when a foreign global recorder (not installed through this function) already exists.

For Exporter::Prometheus this also registers the process_* collector (CPU, memory, fds). No HTTP listener is spawned here — the admin server owns the socket.