From 40600170595ba060bfc201e4bd092cb7da39235d Mon Sep 17 00:00:00 2001 From: Andrei Sandu <54316454+sandreim@users.noreply.github.com> Date: Thu, 19 May 2022 19:53:43 +0300 Subject: [PATCH] Availability: provisioner bitfield metrics (#5484) * Add histogram for inherent data bitfields Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * -500ms bitfield sign job delay, +500ms bitfield gossip Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Revert "-500ms bitfield sign job delay, +500ms bitfield gossip" This reverts commit 3d3f2c0fae651653ffdca50c1ad38c5757166edc. * fmt Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Update node/core/provisioner/src/metrics.rs Co-authored-by: Bernhard Schuster <bernhard@ahoi.io> Co-authored-by: Andronik <write@reusable.software> Co-authored-by: Bernhard Schuster <bernhard@ahoi.io> --- polkadot/node/core/provisioner/src/lib.rs | 1 + polkadot/node/core/provisioner/src/metrics.rs | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/polkadot/node/core/provisioner/src/lib.rs b/polkadot/node/core/provisioner/src/lib.rs index afbdf458746..bef9c642352 100644 --- a/polkadot/node/core/provisioner/src/lib.rs +++ b/polkadot/node/core/provisioner/src/lib.rs @@ -227,6 +227,7 @@ where leaf_hash = ?self.leaf.hash, "inherent data sent successfully" ); + self.metrics.observe_inherent_data_bitfields_count(self.signed_bitfields.len()); } } diff --git a/polkadot/node/core/provisioner/src/metrics.rs b/polkadot/node/core/provisioner/src/metrics.rs index bda0a560979..829293dfed5 100644 --- a/polkadot/node/core/provisioner/src/metrics.rs +++ b/polkadot/node/core/provisioner/src/metrics.rs @@ -21,6 +21,7 @@ struct MetricsInner { inherent_data_requests: prometheus::CounterVec<prometheus::U64>, request_inherent_data: prometheus::Histogram, provisionable_data: prometheus::Histogram, + inherent_data_response_bitfields: prometheus::Histogram, /// The following metrics track how many disputes/votes the runtime will have to process. These will count /// all recent statements meaning every dispute from last sessions: 10 min on Rococo, 60 min on Kusama and @@ -63,6 +64,12 @@ impl Metrics { self.0.as_ref().map(|metrics| metrics.provisionable_data.start_timer()) } + pub(crate) fn observe_inherent_data_bitfields_count(&self, bitfields_count: usize) { + self.0.as_ref().map(|metrics| { + metrics.inherent_data_response_bitfields.observe(bitfields_count as f64) + }); + } + pub(crate) fn inc_valid_statements_by(&self, votes: usize) { if let Some(metrics) = &self.0 { metrics @@ -134,6 +141,15 @@ impl metrics::Metrics for Metrics { )?, registry, )?, + inherent_data_response_bitfields: prometheus::register( + prometheus::Histogram::with_opts( + prometheus::HistogramOpts::new( + "polkadot_parachain_provisioner_inherent_data_response_bitfields_sent", + "Number of inherent bitfields sent in response to `ProvisionerMessage::RequestInherentData`.", + ).buckets(vec![0.0, 10.0, 25.0, 50.0, 75.0, 100.0, 150.0, 200.0, 250.0, 300.0]), + )?, + registry, + )?, }; Ok(Metrics(Some(metrics))) } -- GitLab