Skip to content

Commit

Permalink
add metrics for group size and threshold (#771)
Browse files Browse the repository at this point in the history
fix #767

Co-authored-by: Nicolas Gailly <nikkolasg@users.noreply.github.com>
  • Loading branch information
willscott and nikkolasg committed Apr 14, 2021
1 parent 60b060c commit dbeff67
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions chain/beacon/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ func (d *discrepancyStore) Put(b *chain.Beacon) error {
discrepancy := float64(actual-expected) / float64(time.Millisecond)
metrics.BeaconDiscrepancyLatency.Set(float64(actual-expected) / float64(time.Millisecond))
metrics.LastBeaconRound.Set(float64(b.GetRound()))
metrics.GroupSize.Set(float64(d.group.Len()))
metrics.GroupThreshold.Set(float64(d.group.Threshold))
d.l.Info("NEW_BEACON_STORED", b.String(), "time_discrepancy_ms", discrepancy)
return nil
}
Expand Down
10 changes: 10 additions & 0 deletions metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ var (
Name: "group_connections",
Help: "Number of peers with current GrpcClient connections",
})
GroupSize = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "group_size",
Help: "Number of peers in the current group",
})
GroupThreshold = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "group_threshold",
Help: "Number of shares needed for beacon reconstruction",
})
// BeaconDiscrepancyLatency (Group) millisecond duration between time beacon created and
// calculated time of round.
BeaconDiscrepancyLatency = prometheus.NewGauge(prometheus.GaugeOpts{
Expand Down Expand Up @@ -163,6 +171,8 @@ func bindMetrics() error {
APICallCounter,
GroupDialFailures,
GroupConnections,
GroupSize,
GroupThreshold,
BeaconDiscrepancyLatency,
LastBeaconRound,
}
Expand Down

0 comments on commit dbeff67

Please sign in to comment.