Trait polkadot_overseer::metrics::MetricsTrait

source ·
pub trait MetricsTrait: Default + Clone {
    // Required method
    fn try_register(registry: &Registry) -> Result<Self, Error>;

    // Provided method
    fn register(registry: Option<&Registry>) -> Result<Self, Error> { ... }
}
Expand description

Subsystem- or job-specific Prometheus metrics.

Usually implemented as a wrapper for Option<ActualMetrics> to ensure Default bounds or as a dummy type (). Prometheus metrics internally hold an Arc reference, so cloning them is fine.

Required Methods§

source

fn try_register(registry: &Registry) -> Result<Self, Error>

Try to register metrics in the Prometheus registry.

Provided Methods§

source

fn register(registry: Option<&Registry>) -> Result<Self, Error>

Convenience method to register metrics in the optional Prometheus registry.

If no registry is provided, returns Default::default(). Otherwise, returns the same thing that try_register does.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Metrics for ()

Implementors§