Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
few beefy metrics
  • Loading branch information
dharjeezy committed Dec 12, 2022
commit c860048db19c25256cf37aa7c69e104af6c5a5aa
34 changes: 33 additions & 1 deletion client/beefy/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
//! BEEFY Prometheus metrics definition

use prometheus::{register, Counter, Gauge, PrometheusError, Registry, U64};

/// BEEFY metrics exposed through Prometheus
pub(crate) struct Metrics {
/// Current active validator set id
Expand All @@ -34,6 +33,14 @@ pub(crate) struct Metrics {
pub beefy_should_vote_on: Gauge<U64>,
/// Number of sessions with lagging signed commitment on mandatory block
pub beefy_lagging_sessions: Counter<U64>,
/// Number of validator's trying to vote with no session initialized
pub beefy_voting_with_no_session_initialized: Counter<U64>,
/// Number of times no Authority public key found in store
pub beefy_no_authority_found_in_store: Counter<U64>,
/// Number of Buffered votes
pub beefy_buffered_votes: Counter<U64>,
/// Number of times Buffered votes is full
pub beefy_buffered_votes_full: Counter<U64>,
}

impl Metrics {
Expand Down Expand Up @@ -72,6 +79,31 @@ impl Metrics {
)?,
registry,
)?,
beefy_voting_with_no_session_initialized: register(
Counter::new(
"substrate_voting_with_no_session_initialized",
"Number of validator's trying to vote with no session initialized",
)?,
registry,
)?,
beefy_no_authority_found_in_store: register(
Counter::new(
"substrate_beefy_no_authority_found_in_store",
"Number of times no Authority public key found in store",
)?,
registry,
)?,
beefy_buffered_votes: register(
Counter::new("substrate_beefy_buffered_votes", "Number of Buffered votes")?,
registry,
)?,
beefy_buffered_votes_full: register(
Counter::new(
"substrate_beefy_buffered_votes_full",
"Number of times Buffered votes is full",
)?,
registry,
)?,
})
}
}
Expand Down
3 changes: 3 additions & 0 deletions client/beefy/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ where
if store.intersection(&active).count() == 0 {
let msg = "no authority public key found in store".to_string();
debug!(target: "beefy", "🥩 for block {:?} {}", block, msg);
metric_inc!(self, beefy_no_authority_found_in_store);
Err(Error::Keystore(msg))
} else {
Ok(())
Expand Down Expand Up @@ -491,13 +492,15 @@ where
false,
)?,
RoundAction::Enqueue => {
metric_inc!(self, beefy_buffered_votes);
debug!(target: "beefy", "🥩 Buffer vote for round: {:?}.", block_num);
if self.pending_votes.len() < MAX_BUFFERED_VOTE_ROUNDS {
let votes_vec = self.pending_votes.entry(block_num).or_default();
if votes_vec.try_push(vote).is_err() {
warn!(target: "beefy", "🥩 Buffer vote dropped for round: {:?}", block_num)
}
} else {
metric_inc!(self, beefy_buffered_votes_full);
error!(target: "beefy", "🥩 Buffer justification dropped for round: {:?}.", block_num);
}
},
Expand Down