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

Add previous epoch participation metrics #7142

Merged
merged 4 commits into from
Aug 31, 2020
Merged
Changes from all commits
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
31 changes: 26 additions & 5 deletions beacon-chain/blockchain/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,22 @@ var (
Name: "field_references",
Help: "The number of states a particular field is shared with.",
}, []string{"state"})
totalEligibleBalances = promauto.NewGauge(prometheus.GaugeOpts{
Name: "total_eligible_balances",
Help: "The total amount of ether, in gwei, that is eligible for voting of previous epoch",
prevEpochActiveBalances = promauto.NewGauge(prometheus.GaugeOpts{
Name: "beacon_prev_epoch_active_gwei",
Help: "The total amount of ether, in gwei, that was active for voting of previous epoch",
})
totalVotedTargetBalances = promauto.NewGauge(prometheus.GaugeOpts{
Name: "total_voted_target_balances",
prevEpochSourceBalances = promauto.NewGauge(prometheus.GaugeOpts{
Name: "beacon_prev_epoch_source_gwei",
Help: "The total amount of ether, in gwei, that has been used in voting attestation source of previous epoch",
})
prevEpochTargetBalances = promauto.NewGauge(prometheus.GaugeOpts{
Name: "beacon_prev_epoch_target_gwei",
Help: "The total amount of ether, in gwei, that has been used in voting attestation target of previous epoch",
})
prevEpochHeadBalances = promauto.NewGauge(prometheus.GaugeOpts{
Name: "beacon_prev_epoch_head_gwei",
Help: "The total amount of ether, in gwei, that has been used in voting attestation head of previous epoch",
})
reorgCount = promauto.NewCounter(prometheus.CounterOpts{
Name: "beacon_reorg_total",
Help: "Count the number of times beacon chain has a reorg",
Expand All @@ -106,6 +114,15 @@ var (
Buckets: []float64{1, 2, 3, 4, 6, 32, 64},
},
)
// TODO(7141): Remove deprecated metrics below.
totalEligibleBalances = promauto.NewGauge(prometheus.GaugeOpts{
Name: "total_eligible_balances",
Help: "The total amount of ether, in gwei, that is eligible for voting of previous epoch",
})
totalVotedTargetBalances = promauto.NewGauge(prometheus.GaugeOpts{
Name: "total_voted_target_balances",
Help: "The total amount of ether, in gwei, that has been used in voting attestation target of previous epoch",
})
)

// reportSlotMetrics reports slot related metrics.
Expand Down Expand Up @@ -205,6 +222,10 @@ func reportEpochMetrics(state *stateTrie.BeaconState) {
if precompute.Balances != nil {
totalEligibleBalances.Set(float64(precompute.Balances.ActivePrevEpoch))
totalVotedTargetBalances.Set(float64(precompute.Balances.PrevEpochTargetAttested))
prevEpochActiveBalances.Set(float64(precompute.Balances.ActivePrevEpoch))
prevEpochSourceBalances.Set(float64(precompute.Balances.PrevEpochAttested))
prevEpochTargetBalances.Set(float64(precompute.Balances.PrevEpochTargetAttested))
prevEpochHeadBalances.Set(float64(precompute.Balances.PrevEpochHeadAttested))
}
refMap := state.FieldReferencesCount()
for name, val := range refMap {
Expand Down