Skip to main content

AsyncMetricsCollector

Trait AsyncMetricsCollector 

Source
pub trait AsyncMetricsCollector: Send + Sync {
    // Required methods
    fn counter<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
        value: u64,
        tags: Option<&'life2 [(&'life3 str, &'life4 str)]>,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait;
    fn gauge<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
        value: f64,
        tags: Option<&'life2 [(&'life3 str, &'life4 str)]>,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait;
    fn histogram<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
        value: f64,
        tags: Option<&'life2 [(&'life3 str, &'life4 str)]>,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait;
    fn timer<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = AsyncTimer> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn record_batch<'life0, 'life1, 'async_trait>(
        &'life0 self,
        metrics: &'life1 [MetricRecord],
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn health_check<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn flush<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Async monitoring and metrics abstraction for non-blocking metrics collection

§Async Version

This trait provides async operations for metrics collection with better throughput.

Required Methods§

Source

fn counter<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, name: &'life1 str, value: u64, tags: Option<&'life2 [(&'life3 str, &'life4 str)]>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Record a counter metric

Source

fn gauge<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, name: &'life1 str, value: f64, tags: Option<&'life2 [(&'life3 str, &'life4 str)]>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Record a gauge metric

Source

fn histogram<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, name: &'life1 str, value: f64, tags: Option<&'life2 [(&'life3 str, &'life4 str)]>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Record a histogram metric

Source

fn timer<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = AsyncTimer> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Start an async timer

Provided Methods§

Source

fn record_batch<'life0, 'life1, 'async_trait>( &'life0 self, metrics: &'life1 [MetricRecord], ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Record multiple metrics in batch

Source

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

Health check for metrics collection

Source

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

Flush pending metrics

Implementors§