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.
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.