Browse Source

add rounds metric

pull/1737/head
Anton Kaliaev 7 years ago
parent
commit
0cb50c05fc
No known key found for this signature in database GPG Key ID: 7B6881D965918214
3 changed files with 7 additions and 0 deletions
  1. +1
    -0
      consensus/metrics.go
  2. +1
    -0
      consensus/state.go
  3. +5
    -0
      node/node.go

+ 1
- 0
consensus/metrics.go View File

@ -7,6 +7,7 @@ import "github.com/go-kit/kit/metrics/discard"
// see MetricsProvider for descriptions.
type Metrics struct {
Height metrics.Counter
Rounds metrics.Gauge
Validators metrics.Gauge
ValidatorsPower metrics.Gauge


+ 1
- 0
consensus/state.go View File

@ -697,6 +697,7 @@ func (cs *ConsensusState) enterNewRound(height int64, round int) {
}
logger.Info(cmn.Fmt("enterNewRound(%v/%v). Current: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
cs.metrics.Rounds.Set(float64(round))
// Increment validators if necessary
validators := cs.Validators


+ 5
- 0
node/node.go View File

@ -102,6 +102,11 @@ func DefaultMetricsProvider() *cs.Metrics {
Name: "height",
Help: "Height of the chain.",
}, []string{}),
Rounds: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
Subsystem: "consensus",
Name: "rounds",
Help: "Number of rounds.",
}, []string{}),
Validators: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
Subsystem: "consensus",


Loading…
Cancel
Save