Skip to content
Snippets Groups Projects
Unverified Commit c733c525 authored by Alexandru Vasile's avatar Alexandru Vasile Committed by GitHub
Browse files

beefy/metrics: Add number of live peers available for requests (#5859)


This PR adds a new beefy metric to monitor the number of live beefy
peers.

Part of investigation of litep2p request failures:
https://github.com/paritytech/polkadot-sdk/issues/4985

cc @paritytech/networking

---------

Signed-off-by: default avatarAlexandru Vasile <alexandru.vasile@parity.io>
parent 6a29a61e
Branches
No related merge requests found
Pipeline #500119 waiting for manual action with stages
in 27 minutes and 38 seconds
title: Add number of live peers available for requests
doc:
- audience: [Node Operator, Node Dev]
description: |
This PR adds a new metric for the number of live peers available for beefy requests.
The metric is exposed under the name `substrate_beefy_on_demand_live_peers`.
crates:
- name: sc-consensus-beefy
bump: minor
......@@ -38,7 +38,7 @@ use crate::{
request_response::{Error, JustificationRequest, BEEFY_SYNC_LOG_TARGET},
},
justification::{decode_and_verify_finality_proof, BeefyVersionedFinalityProof},
metric_inc,
metric_inc, metric_set,
metrics::{register_metrics, OnDemandOutgoingRequestsMetrics},
KnownPeers,
};
......@@ -242,6 +242,8 @@ impl<B: Block, AuthorityId: AuthorityIdBound> OnDemandJustificationsEngine<B, Au
// meaning we're done with current state. Move the engine to `State::Idle`.
self.state = State::Idle;
metric_set!(self.metrics, beefy_on_demand_live_peers, self.live_peers.lock().len() as u64);
let block = req_info.block;
match self.process_response(&peer, &req_info, resp) {
Err(err) => {
......
......@@ -236,6 +236,8 @@ pub struct OnDemandOutgoingRequestsMetrics {
pub beefy_on_demand_justification_invalid_proof: Counter<U64>,
/// Number of on-demand justification good proof
pub beefy_on_demand_justification_good_proof: Counter<U64>,
/// Number of live beefy peers available for requests.
pub beefy_on_demand_live_peers: Gauge<U64>,
}
impl PrometheusRegister for OnDemandOutgoingRequestsMetrics {
......@@ -277,6 +279,13 @@ impl PrometheusRegister for OnDemandOutgoingRequestsMetrics {
)?,
registry,
)?,
beefy_on_demand_live_peers: register(
Gauge::new(
"substrate_beefy_on_demand_live_peers",
"Number of live beefy peers available for requests.",
)?,
registry,
)?,
})
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment