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

beefy: Increment metric and add extra log details (#5075)


This PR increments the beefy metric wrt no peers to query justification
from.
The metric is incremented when we submit a request to a known peer,
however that peer failed to provide a valid response, and there are no
further peers to query.

While at it, add a few extra details to identify the number of active
peers and cached peers, together with the request error

Part of:
- https://github.com/paritytech/polkadot-sdk/issues/4985
- https://github.com/paritytech/polkadot-sdk/issues/4925

---------

Signed-off-by: default avatarAlexandru Vasile <alexandru.vasile@parity.io>
parent ae688a97
No related merge requests found
Pipeline #485762 waiting for manual action with stages
in 1 hour, 14 minutes, and 30 seconds
......@@ -75,6 +75,11 @@ impl<B: Block> KnownPeers<B> {
pub fn contains(&self, peer: &PeerId) -> bool {
self.live.contains_key(peer)
}
/// Number of peers in the set.
pub fn len(&self) -> usize {
self.live.len()
}
}
#[cfg(test)]
......
......@@ -249,9 +249,16 @@ impl<B: Block, AuthorityId: AuthorityIdBound> OnDemandJustificationsEngine<B, Au
if let Some(peer) = self.try_next_peer() {
self.request_from_peer(peer, req_info);
} else {
metric_inc!(
self.metrics,
beefy_on_demand_justification_no_peer_to_request_from
);
let num_cache = self.peers_cache.len();
let num_live = self.live_peers.lock().len();
warn!(
target: BEEFY_SYNC_LOG_TARGET,
"🥩 ran out of peers to request justif #{:?} from", block
"🥩 ran out of peers to request justif #{block:?} from num_cache={num_cache} num_live={num_live} err={err:?}",
);
}
// Report peer based on error type.
......@@ -265,7 +272,7 @@ impl<B: Block, AuthorityId: AuthorityIdBound> OnDemandJustificationsEngine<B, Au
metric_inc!(self.metrics, beefy_on_demand_justification_good_proof);
debug!(
target: BEEFY_SYNC_LOG_TARGET,
"🥩 received valid on-demand justif #{:?} from {:?}", block, peer
"🥩 received valid on-demand justif #{block:?} from {peer:?}",
);
let peer_report = PeerReport { who: peer, cost_benefit: benefit::VALIDATED_PROOF };
ResponseInfo::ValidProof(proof, peer_report)
......
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