Skip to content

Commit

Permalink
add ping duration gauge to metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
v9n committed Jul 23, 2024
1 parent 786da8a commit aafbc39
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ type MetricsGenerator interface {
IncWorkerLoop()
IncPing(string)

SetPingDuration(float64)

AddUptime(float64)

IncNumCheckRun(string, string)
Expand All @@ -30,7 +32,10 @@ type AvsAndEigenMetrics struct {
uptime *prometheus.CounterVec

numWorkerLoop *prometheus.CounterVec

numPingSent *prometheus.CounterVec
durationPing *prometheus.GaugeVec

numCheckProcessed *prometheus.CounterVec
numTasksReceived *prometheus.CounterVec
// if numSignedTaskResponsesAcceptedByAggregator != numTasksReceived, then there is a bug
Expand Down Expand Up @@ -67,6 +72,14 @@ func NewAvsAndEigenMetrics(avsName, operatorAddress, version string, eigenMetric
Help: "The number of heartbeat send by operator. If it isn't increasing, the operator failed to communicate with aggregator",
}, []string{"operator", "version", "status"}),

durationPing: promauto.With(reg).NewGaugeVec(
prometheus.GaugeOpts{
Namespace: apNamespace,
Name: "ping_duration_seconds",
Help: "The duration of ping check send to operator. If it spikes, it could indicator aggreator issues or operator network issue",
}, []string{"operator", "version",}),


numCheckProcessed: promauto.With(reg).NewCounterVec(
prometheus.CounterOpts{
Namespace: apNamespace,
Expand Down Expand Up @@ -116,3 +129,7 @@ func (m *AvsAndEigenMetrics) IncNumCheckRun(checkType, status string) {
func (m *AvsAndEigenMetrics) AddUptime(total float64) {
m.uptime.WithLabelValues(m.operatorAddress, m.version).Add(total)
}

func (m *AvsAndEigenMetrics) SetPingDuration(duration float64) {
m.durationPing.WithLabelValues(m.operatorAddress, m.version).Set(duration)
}

0 comments on commit aafbc39

Please sign in to comment.