mirror of
https://github.com/tendermint/tendermint.git
synced 2026-07-20 06:52:30 +00:00
add metric for vote send count
This commit is contained in:
@@ -93,6 +93,8 @@ type Metrics struct {
|
||||
FullPrevoteMessageDelay metrics.Gauge
|
||||
|
||||
DuplicateVoteReceive metrics.Counter
|
||||
|
||||
VoteSent metrics.Counter
|
||||
}
|
||||
|
||||
// PrometheusMetrics returns Metrics build using Prometheus client library.
|
||||
@@ -259,6 +261,12 @@ func PrometheusMetrics(namespace string, labelsAndValues ...string) *Metrics {
|
||||
Name: "duplicate_vote_receive",
|
||||
Help: "Number of votes received multiple times from the same peer by peer",
|
||||
}, append(labels, "peer_id", "type")).With(labelsAndValues...),
|
||||
VoteSent: prometheus.NewCounterFrom(stdprometheus.CounterOpts{
|
||||
Namespace: namespace,
|
||||
Subsystem: MetricsSubsystem,
|
||||
Name: "vote_sent",
|
||||
Help: "Number of votes sent by type",
|
||||
}, append(labels, "type")).With(labelsAndValues...),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,6 +303,7 @@ func NopMetrics() *Metrics {
|
||||
QuorumPrevoteMessageDelay: discard.NewGauge(),
|
||||
FullPrevoteMessageDelay: discard.NewGauge(),
|
||||
DuplicateVoteReceive: discard.NewCounter(),
|
||||
VoteSent: discard.NewCounter(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -819,6 +819,7 @@ func (conR *Reactor) gossipVotesForHeight(
|
||||
// If there are prevotes to send...
|
||||
if prs.Step <= cstypes.RoundStepPrevoteWait && prs.Round != -1 && prs.Round <= rs.Round {
|
||||
if ps.PickSendVote(rs.Votes.Prevotes(prs.Round)) {
|
||||
conR.Metrics.VoteSent.With("type", "prevote").Add(1)
|
||||
logger.Debug("Picked rs.Prevotes(prs.Round) to send", "round", prs.Round)
|
||||
return true
|
||||
}
|
||||
@@ -826,6 +827,7 @@ func (conR *Reactor) gossipVotesForHeight(
|
||||
// If there are precommits to send...
|
||||
if prs.Step <= cstypes.RoundStepPrecommitWait && prs.Round != -1 && prs.Round <= rs.Round {
|
||||
if ps.PickSendVote(rs.Votes.Precommits(prs.Round)) {
|
||||
conR.Metrics.VoteSent.With("type", "precommit").Add(1)
|
||||
logger.Debug("Picked rs.Precommits(prs.Round) to send", "round", prs.Round)
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user