pub trait MetricsCallbackProvider: Send + Sync + Clone + 'static {
    // Required methods
    fn on_request(&self, path: String);
    fn on_response(
        &self,
        path: String,
        latency: Duration,
        status: u16,
        grpc_status_code: Code,
    );

    // Provided methods
    fn on_start(&self, _path: &str) { ... }
    fn on_drop(&self, _path: &str) { ... }
}
Expand description

The trait to be implemented when want to be notified about a new request and related metrics around it. When a request is performed (up to the point that a response is created) the on_response method is called with the corresponding metrics details. The on_request method will be called when the request is received, but not further processing has happened at this point.

Required Methods§

source

fn on_request(&self, path: String)

Method will be called when a request has been received. path: the endpoint uri path

source

fn on_response( &self, path: String, latency: Duration, status: u16, grpc_status_code: Code, )

Method to be called from the server when a request is performed. path: the endpoint uri path latency: the time when the request was received and when the response was created status: the http status code of the response grpc_status_code: the grpc status code (see https://github.com/grpc/grpc/blob/master/doc/statuscodes.md#status-codes-and-their-use-in-grpc)

Provided Methods§

source

fn on_start(&self, _path: &str)

Called when request call is started

source

fn on_drop(&self, _path: &str)

Called when request call is dropped. It is guaranteed that for each on_start there will be corresponding on_drop

Object Safety§

This trait is not object safe.

Implementors§