Skip to main content

init_metrics_or_noop

Function init_metrics_or_noop 

Source
pub fn init_metrics_or_noop<I, B, E, R>(
    init_metrics: I,
    build_recorder: B,
) -> SharedMetricsRecorder
where I: FnOnce() -> Result<(), E>, B: FnOnce() -> R, E: Display, R: MetricsRecorder + 'static,
Expand description

Initializes a concrete metrics backend or falls back to NoopMetrics.

Product crates own concrete exporters and feature flags. This helper only centralizes the common startup mechanics used by Aster services: try to initialize the product metrics backend, return the concrete recorder on success, and keep startup working with a no-op recorder on initialization failure.