Skip to content

Commit

Permalink
Metrics with time in the queue (#714)
Browse files Browse the repository at this point in the history
time in the queue added
  • Loading branch information
jaroslaw-pieszka authored Apr 26, 2024
1 parent 9aa134f commit 7c832fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/subaccountsync/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type Metrics struct {
cisRequests *prometheus.CounterVec
states *prometheus.GaugeVec
informer *prometheus.CounterVec
timeInQueue prometheus.Gauge
}

func NewMetrics(reg prometheus.Registerer, namespace string) *Metrics {
Expand Down Expand Up @@ -37,6 +38,11 @@ func NewMetrics(reg prometheus.Registerer, namespace string) *Metrics {
Name: "priority_queue_size",
Help: "Queue size.",
}),
timeInQueue: prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: namespace,
Name: "time_in_queue",
Help: "Time spent in queue.",
}),
}
reg.MustRegister(m.queue, m.queueOps, m.states, m.informer, m.cisRequests)
return m
Expand Down
1 change: 1 addition & 0 deletions internal/subaccountsync/subaccount_sync_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ func (s *SyncService) Run() {
OnExtract: func(queueSize int, timeEnqueued int64) {
metrics.queue.Set(float64(queueSize))
metrics.queueOps.With(prometheus.Labels{"operation": "extract"}).Inc()
metrics.timeInQueue.Set(float64(epochInMillis() - timeEnqueued))
},
})

Expand Down

0 comments on commit 7c832fd

Please sign in to comment.