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:?}");
    }
}

Modules§

control
The control plane’s label values (audit H11; ADR 0038 section 4).
event_append_error
Error kinds passed to Metrics::on_persistence_error for persistence_operation::EVENT_APPEND.
event_log_catchup_error
Error kinds passed to Metrics::on_persistence_error for persistence_operation::EVENT_LOG_CATCHUP.
executor_outcome
How an executor’s run ended, as Metrics::on_executor_run reports it.
persistence_operation
Operation labels passed to Metrics::on_persistence_error.
push_outcome
Outcome labels passed to Metrics::on_push_delivery.
queue_handoff_error
Error kinds passed to Metrics::on_persistence_error for persistence_operation::QUEUE_HANDOFF.
subscribe_wake
Why a SubscribeToTask stream stopped waiting on a task’s event log, as Metrics::on_subscribe_wake reports it (audit E-F25 (b), ADR 0057).

Structs§

ConnectionPoolStats
Statistics about the HTTP connection pool.
MetricsHandle
A shareable Metrics a store can hold, and discard into by default.
NoopMetrics
A no-op Metrics implementation that discards all events.
RpcCall
One finished inbound call, as Metrics::on_rpc_call reports it.

Traits§

Metrics
Trait for receiving metrics callbacks from the handler.