Skip to content

Commit

Permalink
Add per quorum semever stake percentage metrics (#856)
Browse files Browse the repository at this point in the history
  • Loading branch information
pschork authored Oct 31, 2024
1 parent a44b1a6 commit f3cec0c
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion disperser/dataapi/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ type Metrics struct {

NumRequests *prometheus.CounterVec
Latency *prometheus.SummaryVec
Semvers *prometheus.GaugeVec
OperatorsStake *prometheus.GaugeVec

Semvers *prometheus.GaugeVec
SemversStakePctQuorum0 *prometheus.GaugeVec
SemversStakePctQuorum1 *prometheus.GaugeVec
SemversStakePctQuorum2 *prometheus.GaugeVec

httpPort string
logger logging.Logger
}
Expand Down Expand Up @@ -64,6 +68,27 @@ func NewMetrics(blobMetadataStore *blobstore.BlobMetadataStore, httpPort string,
},
[]string{"semver"},
),
SemversStakePctQuorum0: promauto.With(reg).NewGaugeVec(
prometheus.GaugeOpts{
Name: "node_semvers_stake_pct_quorum_0",
Help: "Node semver stake percentage in quorum 0",
},
[]string{"semver_stake_pct_quorum_0"},
),
SemversStakePctQuorum1: promauto.With(reg).NewGaugeVec(
prometheus.GaugeOpts{
Name: "node_semvers_stake_pct_quorum_1",
Help: "Node semver stake percentage in quorum 1",
},
[]string{"semver_stake_pct_quorum_1"},
),
SemversStakePctQuorum2: promauto.With(reg).NewGaugeVec(
prometheus.GaugeOpts{
Name: "node_semvers_stake_pct_quorum_2",
Help: "Node semver stake percentage in quorum 2",
},
[]string{"semver_stake_pct_quorum_2"},
),
OperatorsStake: promauto.With(reg).NewGaugeVec(
prometheus.GaugeOpts{
Namespace: namespace,
Expand Down Expand Up @@ -114,6 +139,18 @@ func (g *Metrics) IncrementNotFoundRequestNum(method string) {
func (g *Metrics) UpdateSemverCounts(semverData map[string]*semver.SemverMetrics) {
for semver, metrics := range semverData {
g.Semvers.WithLabelValues(semver).Set(float64(metrics.Operators))
for quorum, stakePct := range metrics.QuorumStakePercentage {
switch quorum {
case 0:
g.SemversStakePctQuorum0.WithLabelValues(semver).Set(stakePct)
case 1:
g.SemversStakePctQuorum1.WithLabelValues(semver).Set(stakePct)
case 2:
g.SemversStakePctQuorum2.WithLabelValues(semver).Set(stakePct)
default:
g.logger.Error("Unable to log semver quorum stake percentage for quorum", "semver", semver, "quorum", quorum, "stake", stakePct)
}
}
}
}

Expand Down

0 comments on commit f3cec0c

Please sign in to comment.