Skip to main content

Module metrics

Module metrics 

Source
Expand description

Metrics hooks for observing handler activity.

Implement Metrics to receive callbacks on requests, responses, errors, latency, and queue depth changes. The default no-op implementation can be overridden selectively.

§Example

use a2a_protocol_server::metrics::Metrics;
use std::time::Duration;

struct MyMetrics;

impl Metrics for MyMetrics {
    fn on_request(&self, method: &str) {
        println!("request: {method}");
    }
    fn on_latency(&self, method: &str, duration: Duration) {
        println!("{method} took {duration:?}");
    }
}

Structs§

ConnectionPoolStats
Statistics about the HTTP connection pool.
NoopMetrics
A no-op Metrics implementation that discards all events.

Traits§

Metrics
Trait for receiving metrics callbacks from the handler.