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
| Value | HTTP | gRPC |
|---|---|---|
method | Method such as GET | RPC name such as CreateTask |
path | Matched route template | Full service and RPC path |
status | Numeric HTTP status | Numeric tonic status code |
transport | Transport::Http | Transport::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§
Sourcefn record_request(
&self,
_transport: Transport,
_method: &str,
_path: &str,
_status: u16,
_duration_ms: u64,
)
fn record_request( &self, _transport: Transport, _method: &str, _path: &str, _status: u16, _duration_ms: u64, )
Records one completed request or terminated stream.
Sourcefn record_in_flight_delta(&self, _transport: Transport, _delta: i64)
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".