Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ready for demo #106

Merged
merged 5 commits into from
Aug 28, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add Validators in metric of consensus.
  • Loading branch information
zemyblue committed Jul 27, 2020
commit 95b89d10c458cc7ec6cbf247ec663cd9c63c4a53
9 changes: 9 additions & 0 deletions consensus/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ type Metrics struct {
Rounds metrics.Gauge

// ValidatorOrVoter: voter
// Number of validators
Validators metrics.Gauge
// Number of voters.
Voters metrics.Gauge
// Total power of all voters.
Expand Down Expand Up @@ -83,6 +85,12 @@ func PrometheusMetrics(namespace string, labelsAndValues ...string) *Metrics {
Help: "Number of rounds.",
}, labels).With(labelsAndValues...),

Validators: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
Namespace: namespace,
Subsystem: MetricsSubsystem,
Name: "validators",
Help: "Number of validators.",
}, labels).With(labelsAndValues...),
Voters: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
Namespace: namespace,
Subsystem: MetricsSubsystem,
Expand Down Expand Up @@ -193,6 +201,7 @@ func NopMetrics() *Metrics {

Rounds: discard.NewGauge(),

Validators: discard.NewGauge(),
Voters: discard.NewGauge(),
VotersPower: discard.NewGauge(),
VoterPower: discard.NewGauge(),
Expand Down