Skip to content

consensus: add total vote/commit metrics to measure on-time vs late - #5099

Open
GheisMohammadi wants to merge 1 commit into
devfrom
feature/vote_metrics
Open

consensus: add total vote/commit metrics to measure on-time vs late#5099
GheisMohammadi wants to merge 1 commit into
devfrom
feature/vote_metrics

Conversation

@GheisMohammadi

Copy link
Copy Markdown
Collaborator

Adds hmy_consensus_signature_total so we can see how many prepare/commit votes and local commit inclusions were on time vs late. The existing hmy_consensus_late_signature metric is unchanged.

Metrics

Both counters use the same labels: role (leader | validator) and phase (PREPARE | COMMIT | committed).

Metric Meaning
hmy_consensus_signature_total All relevant votes/checks: accepted (on time) or late
hmy_consensus_late_signature Only the late / missing ones

Leader (role=leader, phase=PREPARE or COMMIT)

  • Accepted / on time: prepare or commit vote accepted during the current block
  • Late: vote for the previous block that arrived after that block was finalized
  • Total: accepted + late

Validator (role=validator, phase=committed)

  • Accepted / on time: local COMMIT key present in the final COMMITTED bitmap
  • Late: local COMMIT key missing from that bitmap
  • Total: every local committee key checked in the bitmap

How to calculate

What you want Formula
Total hmy_consensus_signature_total
Late hmy_consensus_late_signature
On time / accepted signature_total - late_signature
Late rate late_signature / signature_total
On-time rate 1 - (late_signature / signature_total)

Example PromQL:

# late rate (leader commits)
rate(hmy_consensus_late_signature{role="leader",phase="COMMIT"}[5m])
/
rate(hmy_consensus_signature_total{role="leader",phase="COMMIT"}[5m])

# on-time count
hmy_consensus_signature_total - on(role,phase) hmy_consensus_late_signature

@GheisMohammadi GheisMohammadi self-assigned this Aug 11, 2026
Comment thread consensus/leader.go
consensus.getLogger().Warn().Err(err).Msg("[OnPrepare] prepareBitmap.SetKey failed")
return
}
consensus.reportAcceptedVote(recvMsg.MessageType.String())

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to clarify the intended behavior: if a validator sends one aggregated vote containing 10 BLS keys, signature_total is incremented by 1 rather than 10 here. Is that the expected unit for this metric?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants