query_duration_metric

Function query_duration_metric 

Source
pub fn query_duration_metric(endpoint: &str) -> HistogramTiming
Expand description

Returns a [HistogramTiming] instance for measuring query duration.

Duration measurement starts when this function is called, and stops when returned value goes out of scope.

§Arguments

  • endpoint - A string slice representing the query name.

§Examples

use drive_abci::metrics::query_duration_metric;
let endpoint = "get_identity";
let timing = query_duration_metric(endpoint);
// Your code here
drop(timing); // stop measurement and report the metric