Skip to main content

MetricsCollector

Trait MetricsCollector 

Source
pub trait MetricsCollector: Send + Sync {
    // Required methods
    fn record_request<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        request: &'life1 HttpRequest,
        response: &'life2 HttpResponse,
        duration: Duration,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn record_error<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        error: &'life1 FerrumError,
        endpoint: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_metrics(&self) -> ServerMetrics;
    fn reset_metrics<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Metrics collector for server

Required Methods§

Source

fn record_request<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, request: &'life1 HttpRequest, response: &'life2 HttpResponse, duration: Duration, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Record request metrics

Source

fn record_error<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, error: &'life1 FerrumError, endpoint: &'life2 str, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Record error metrics

Source

fn get_metrics(&self) -> ServerMetrics

Get current metrics

Source

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

Reset metrics

Implementors§