pub trait MetricsConsumer {
    type Metric;

    // Required methods
    fn new(client: Client) -> Self;
    fn accept(&mut self, metric: Self::Metric);
    fn flush<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Aggregator for metrics. An aggregator should collect metrics so they can be batch dispatched.

Required Associated Types§

source

type Metric

The metrics type.

Required Methods§

source

fn new(client: Client) -> Self

Create a new instance for the given client.

source

fn accept(&mut self, metric: Self::Metric)

Consume a metric.

source

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

Flush all consumed metrics to the database.

Object Safety§

This trait is not object safe.

Implementors§