From ef6ae48508af5d2f44e949985eeed1ea9c81c366 Mon Sep 17 00:00:00 2001 From: Alexandru Gheorghe <49718502+alexggh@users.noreply.github.com> Date: Thu, 8 Jun 2023 12:26:36 +0300 Subject: [PATCH] metrics: Increase the resolution of histogram metrics (#7335) * metrics: Increase the resolution of histogram metrics These metrics are using the default histogram buckets: ``` pub const DEFAULT_BUCKETS: &[f64; 11] = &[ 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0, ]; ``` Which give us a resolution of 5ms, that's good, but there are some subsystems where we process hundreds or even a few thousands of messages per second like approval-voting or approval-distribution, so it makes sense to increse the resoution of the bucket to better understand if the procesisng is in the range of useconds. The new bucket ranges will be: ``` [0.0001, 0.0004, 0.0016, 0.0064, 0.0256, 0.1024, 0.4096, 1.6384, 6.5536] ``` Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io> * Use buckets with higher resolution Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io> --------- Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io> --- .../network/approval-distribution/src/metrics.rs | 4 ++-- polkadot/node/overseer/src/metrics.rs | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/polkadot/node/network/approval-distribution/src/metrics.rs b/polkadot/node/network/approval-distribution/src/metrics.rs index 3cdc64a8b76..896866ce099 100644 --- a/polkadot/node/network/approval-distribution/src/metrics.rs +++ b/polkadot/node/network/approval-distribution/src/metrics.rs @@ -134,14 +134,14 @@ impl MetricsTrait for Metrics { prometheus::Histogram::with_opts(prometheus::HistogramOpts::new( "polkadot_parachain_time_import_pending_now_known", "Time spent on importing pending assignments and approvals.", - ))?, + ).buckets(vec![0.0001, 0.0004, 0.0016, 0.0064, 0.0256, 0.1024, 0.4096, 1.6384, 3.2768, 4.9152, 6.5536,]))?, registry, )?, time_awaiting_approval_voting: prometheus::register( prometheus::Histogram::with_opts(prometheus::HistogramOpts::new( "polkadot_parachain_time_awaiting_approval_voting", "Time spent awaiting a reply from the Approval Voting Subsystem.", - ))?, + ).buckets(vec![0.0001, 0.0004, 0.0016, 0.0064, 0.0256, 0.1024, 0.4096, 1.6384, 3.2768, 4.9152, 6.5536,]))?, registry, )?, }; diff --git a/polkadot/node/overseer/src/metrics.rs b/polkadot/node/overseer/src/metrics.rs index d5acf330831..9b6053ccf76 100644 --- a/polkadot/node/overseer/src/metrics.rs +++ b/polkadot/node/overseer/src/metrics.rs @@ -165,7 +165,11 @@ impl MetricsTrait for Metrics { prometheus::HistogramOpts::new( "polkadot_parachain_subsystem_bounded_tof", "Duration spent in a particular channel from entrance to removal", - ), + ) + .buckets(vec![ + 0.0001, 0.0004, 0.0016, 0.0064, 0.0256, 0.1024, 0.4096, 1.6384, 3.2768, + 4.9152, 6.5536, + ]), &["subsystem_name"], )?, registry, @@ -205,7 +209,11 @@ impl MetricsTrait for Metrics { prometheus::HistogramOpts::new( "polkadot_parachain_subsystem_unbounded_tof", "Duration spent in a particular channel from entrance to removal", - ), + ) + .buckets(vec![ + 0.0001, 0.0004, 0.0016, 0.0064, 0.0256, 0.1024, 0.4096, 1.6384, 3.2768, + 4.9152, 6.5536, + ]), &["subsystem_name"], )?, registry, -- GitLab