diff --git a/storage/metrics.go b/storage/metrics.go index 772b7e242..505407ee5 100644 --- a/storage/metrics.go +++ b/storage/metrics.go @@ -59,20 +59,20 @@ var ( Help: "Total number of keys.", }) - watchersGauge = prometheus.NewGauge( + watchingGauge = prometheus.NewGauge( prometheus.GaugeOpts{ Namespace: "etcd", Subsystem: "storage", - Name: "watchers_total", - Help: "Total number of watchers.", + Name: "watching_total", + Help: "Total number of watchings.", }) - slowWatchersGauge = prometheus.NewGauge( + slowWatchingGauge = prometheus.NewGauge( prometheus.GaugeOpts{ Namespace: "etcd", Subsystem: "storage", - Name: "slow_watchers_total", - Help: "Total number of unsynced slow watchers.", + Name: "slow_watching_total", + Help: "Total number of unsynced slow watchings.", }) totalEventsCounter = prometheus.NewCounter( @@ -135,9 +135,9 @@ func init() { prometheus.MustRegister(deleteCounter) prometheus.MustRegister(txnCounter) prometheus.MustRegister(keysGauge) - prometheus.MustRegister(watchersGauge) + prometheus.MustRegister(watchingGauge) prometheus.MustRegister(totalEventsCounter) - prometheus.MustRegister(slowWatchersGauge) + prometheus.MustRegister(slowWatchingGauge) prometheus.MustRegister(pendingEventsGauge) prometheus.MustRegister(indexCompactionPauseDurations) prometheus.MustRegister(dbCompactionPauseDurations) diff --git a/storage/watchable_store.go b/storage/watchable_store.go index 5535965a5..02c790f05 100644 --- a/storage/watchable_store.go +++ b/storage/watchable_store.go @@ -186,10 +186,10 @@ func (s *watchableStore) watch(key []byte, prefix bool, startRev int64, ch chan< if startRev == 0 { s.synced[k] = append(s.synced[k], wa) } else { - slowWatchersGauge.Inc() + slowWatchingGauge.Inc() s.unsynced[wa] = struct{}{} } - watchersGauge.Inc() + watchingGauge.Inc() cancel := CancelFunc(func() { s.mu.Lock() @@ -197,15 +197,15 @@ func (s *watchableStore) watch(key []byte, prefix bool, startRev int64, ch chan< // remove global references of the watching if _, ok := s.unsynced[wa]; ok { delete(s.unsynced, wa) - slowWatchersGauge.Dec() - watchersGauge.Dec() + slowWatchingGauge.Dec() + watchingGauge.Dec() return } for i, w := range s.synced[k] { if w == wa { s.synced[k] = append(s.synced[k][:i], s.synced[k][i+1:]...) - watchersGauge.Dec() + watchingGauge.Dec() } } // If we cannot find it, it should have finished watch. @@ -267,7 +267,7 @@ func (s *watchableStore) syncWatchings() { // put it back to try it in the next round w.cur = nextRev } - slowWatchersGauge.Set(float64(len(s.unsynced))) + slowWatchingGauge.Set(float64(len(s.unsynced))) } // handle handles the change of the happening event on all watchings. @@ -295,7 +295,7 @@ func (s *watchableStore) notify(rev int64, ev storagepb.Event) { default: w.cur = rev s.unsynced[w] = struct{}{} - slowWatchersGauge.Inc() + slowWatchingGauge.Inc() } } s.synced[string(ev.Kv.Key[:i])] = nws