Skip to content

Commit

Permalink
[consensus] record timeout author with reason in metrics (#15157)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibalajiarun authored Nov 1, 2024
1 parent 48f26a8 commit 3cad55d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion consensus/src/counters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ pub static AGGREGATED_ROUND_TIMEOUT_REASON: Lazy<IntCounterVec> = Lazy::new(|| {
register_int_counter_vec!(
"aptos_consensus_agg_round_timeout_reason",
"Count of round timeouts by reason",
&["reason", "is_next_proposer"],
&["reason", "author", "is_next_proposer"],
)
.unwrap()
});
Expand Down
12 changes: 10 additions & 2 deletions consensus/src/round_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,13 @@ impl RoundManager {
&mut self,
new_round_event: NewRoundEvent,
) -> anyhow::Result<()> {
let new_round = new_round_event.round;
let is_current_proposer = self
.proposer_election
.is_valid_proposer(self.proposal_generator.author(), new_round_event.round);
.is_valid_proposer(self.proposal_generator.author(), new_round);
let prev_proposer = self
.proposer_election
.get_valid_proposer(new_round.saturating_sub(1));

counters::CURRENT_ROUND.set(new_round_event.round as i64);
counters::ROUND_TIMEOUT_MS.set(new_round_event.timeout.as_millis() as i64);
Expand All @@ -368,7 +372,11 @@ impl RoundManager {
NewRoundReason::Timeout(ref reason) => {
counters::TIMEOUT_ROUNDS_COUNT.inc();
counters::AGGREGATED_ROUND_TIMEOUT_REASON
.with_label_values(&[&reason.to_string(), &is_current_proposer.to_string()])
.with_label_values(&[
&reason.to_string(),
prev_proposer.short_str().as_str(),
&is_current_proposer.to_string(),
])
.inc();
if is_current_proposer {
if let RoundTimeoutReason::PayloadUnavailable { missing_authors } = reason {
Expand Down

0 comments on commit 3cad55d

Please sign in to comment.