add height for outlier message delays

This commit is contained in:
William Banfield
2022-01-26 17:19:08 -05:00
parent bc63f213da
commit 4efc8a4485
2 changed files with 14 additions and 4 deletions

View File

@@ -208,14 +208,14 @@ func PrometheusMetrics(namespace string, labelsAndValues ...string) *Metrics {
Name: "quorum_prevote_message_delay",
Help: "Difference in seconds between the proposal timestamp and the timestamp " +
"of the latest prevote that achieved a quorum in the prevote step.",
}, labels).With(labelsAndValues...),
}, append(labels, "height")).With(labelsAndValues...),
FullPrevoteMessageDelay: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
Namespace: namespace,
Subsystem: MetricsSubsystem,
Name: "full_prevote_message_delay",
Help: "Difference in seconds between the proposal timestamp and the timestamp " +
"of the latest prevote that achieved 100% of the voting power in the prevote step.",
}, labels).With(labelsAndValues...),
}, append(labels, "height")).With(labelsAndValues...),
}
}

View File

@@ -2294,12 +2294,22 @@ func (cs *State) calculatePrevoteMessageDelayMetrics() {
_, val := cs.Validators.GetByAddress(v.ValidatorAddress)
votingPowerSeen += val.VotingPower
if votingPowerSeen >= cs.Validators.TotalVotingPower()*2/3+1 {
cs.metrics.QuorumPrevoteMessageDelay.Set(v.Timestamp.Sub(cs.Proposal.Timestamp).Seconds())
delay := v.Timestamp.Sub(cs.Proposal.Timestamp)
if delay >= 10*time.Second {
cs.metrics.QuorumPrevoteMessageDelay.With("height", fmt.Sprintf("%d", cs.Height)).Set(delay.Seconds())
} else {
cs.metrics.QuorumPrevoteMessageDelay.With("height", "none").Set(delay.Seconds())
}
break
}
}
if ps.HasAll() {
cs.metrics.FullPrevoteMessageDelay.Set(pl[len(pl)-1].Timestamp.Sub(cs.Proposal.Timestamp).Seconds())
delay := pl[len(pl)-1].Timestamp.Sub(cs.Proposal.Timestamp)
if delay >= 10*time.Second {
cs.metrics.FullPrevoteMessageDelay.With("height", fmt.Sprintf("%d", cs.Height)).Set(delay.Seconds())
} else {
cs.metrics.FullPrevoteMessageDelay.With("height", "none").Set(delay.Seconds())
}
}
}