referrerpolicy=no-referrer-when-downgrade

Trait relay_utils::metrics::StandaloneMetric

source ·
pub trait StandaloneMetric: Metric {
    // Required methods
    fn update<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update_interval(&self) -> Duration;

    // Provided methods
    fn register_and_spawn(
        self,
        registry: &Registry,
    ) -> Result<(), PrometheusError> { ... }
    fn spawn(self) { ... }
}
Expand description

Standalone metric API.

Metrics of this kind know how to update themselves, so we may just spawn and forget the asynchronous self-update task.

Required Methods§

source

fn update<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Update metric values.

source

fn update_interval(&self) -> Duration

Metrics update interval.

Provided Methods§

source

fn register_and_spawn(self, registry: &Registry) -> Result<(), PrometheusError>

Register and spawn metric. Metric is only spawned if it is registered for the first time.

source

fn spawn(self)

Spawn the self update task that will keep update metric value at given intervals.

Object Safety§

This trait is not object safe.

Implementors§