referrerpolicy=no-referrer-when-downgrade
polkadot_node_metrics::metrics

Trait Metrics

Source
pub trait Metrics: Default + Clone {
    // Required method
    fn try_register(registry: &Registry) -> Result<Self, PrometheusError>;

    // Provided method
    fn register(registry: Option<&Registry>) -> Result<Self, PrometheusError> { ... }
}
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, PrometheusError>

Try to register metrics in the Prometheus registry.

Provided Methods§

Source

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

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Metrics for ()

Source§

fn try_register(_registry: &Registry) -> Result<(), PrometheusError>

Implementors§

impl Metrics for Metrics

impl Metrics for Metrics

impl Metrics for Metrics

impl Metrics for Metrics

impl Metrics for Metrics

impl Metrics for Metrics

impl Metrics for Metrics

impl Metrics for Metrics

impl Metrics for Metrics

impl Metrics for Metrics

impl Metrics for Metrics