MetricsExt

Trait MetricsExt 

Source
pub trait MetricsExt: Metrics {
    // Provided methods
    async fn record_request(
        &self,
        name: &str,
        timer: Option<Box<dyn Timer + Send>>,
        success: bool,
    ) { ... }
    async fn record_request_with_tags(
        &self,
        name: &str,
        timer: Option<Box<dyn Timer + Send>>,
        success: bool,
        tags: &[(&str, &str)],
    ) { ... }
    async fn record_error_with_context(
        &self,
        name: &str,
        error_type: &str,
        context: &str,
    ) { ... }
    async fn record_complete_request(
        &self,
        name: &str,
        timer: Option<Box<dyn Timer + Send>>,
        status_code: u16,
        success: bool,
        tags: &[(&str, &str)],
    ) { ... }
    async fn record_batch_latency_percentiles(
        &self,
        name: &str,
        measurements: &[f64],
        tags: &[(&str, &str)],
    ) { ... }
}
Expand description

Convenience methods for common metric patterns

Provided Methods§

Source

async fn record_request( &self, name: &str, timer: Option<Box<dyn Timer + Send>>, success: bool, )

Record a request with timing and success/failure

Source

async fn record_request_with_tags( &self, name: &str, timer: Option<Box<dyn Timer + Send>>, success: bool, tags: &[(&str, &str)], )

Record a request with timing, success/failure, and tags

Source

async fn record_error_with_context( &self, name: &str, error_type: &str, context: &str, )

Record an error with context

Source

async fn record_complete_request( &self, name: &str, timer: Option<Box<dyn Timer + Send>>, status_code: u16, success: bool, tags: &[(&str, &str)], )

Record a complete request with timing, status, and success metrics

Source

async fn record_batch_latency_percentiles( &self, name: &str, measurements: &[f64], tags: &[(&str, &str)], )

Record latency percentiles for a batch of measurements

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.

Implementors§