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§
sourcefn update<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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.
sourcefn update_interval(&self) -> Duration
fn update_interval(&self) -> Duration
Metrics update interval.
Provided Methods§
sourcefn register_and_spawn(self, registry: &Registry) -> Result<(), PrometheusError>
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.
Object Safety§
This trait is not object safe.