feat(rpc middleware): use custom time buckets (#11950)

* feat(rpc middleware): use custom time buckets

* cargo fmt

* make it compile again

* fix bad comment
This commit is contained in:
Niklas Adolfsson
2022-08-12 17:39:05 +02:00
committed by GitHub
parent 187735908f
commit 4c280059ab
+17 -1
View File
@@ -25,6 +25,21 @@ use prometheus_endpoint::{
};
use std::net::SocketAddr;
/// Histogram time buckets in microseconds.
const HISTOGRAM_BUCKETS: [f64; 11] = [
5.0,
25.0,
100.0,
500.0,
1_000.0,
2_500.0,
10_000.0,
25_000.0,
100_000.0,
1_000_000.0,
10_000_000.0,
];
/// Metrics for RPC middleware storing information about the number of requests started/completed,
/// calls started/completed and their timings.
#[derive(Debug, Clone)]
@@ -75,7 +90,8 @@ impl RpcMetrics {
HistogramOpts::new(
"substrate_rpc_calls_time",
"Total time [μs] of processed RPC calls",
),
)
.buckets(HISTOGRAM_BUCKETS.to_vec()),
&["protocol", "method"],
)?,
metrics_registry,