Skip to main content

ApiMetricsBackend

Trait ApiMetricsBackend 

Source
pub trait ApiMetricsBackend:
    Send
    + Sync
    + Debug {
    // Provided methods
    fn record_request(
        &self,
        _transport: Transport,
        _method: &str,
        _path: &str,
        _status: u16,
        _duration_ms: u64,
    ) { ... }
    fn record_in_flight_delta(&self, _transport: Transport, _delta: i64) { ... }
}
Expand description

Receives API request lifecycle metrics.

§Labels

ValueHTTPgRPC
methodMethod such as GETRPC name such as CreateTask
pathMatched route templateFull service and RPC path
statusNumeric HTTP statusNumeric tonic status code
transportTransport::HttpTransport::Grpc

record_request is called after normal completion or stream termination. It is not called when a request future or stream is dropped first. The in-flight decrement still occurs on drop.

Provided Methods§

Source

fn record_request( &self, _transport: Transport, _method: &str, _path: &str, _status: u16, _duration_ms: u64, )

Records one completed request or terminated stream.

Source

fn record_in_flight_delta(&self, _transport: Transport, _delta: i64)

Adjusts the in-flight gauge.

Entry uses 1. Completion, failure, cancellation, and drop use -1.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§