Merge pull request #3799 from gyuho/nameing_in_metrics_watching
storage: apply same naming in metrics.gorelease-2.3
commit
70cb8b8391
|
@ -59,20 +59,20 @@ var (
|
||||||
Help: "Total number of keys.",
|
Help: "Total number of keys.",
|
||||||
})
|
})
|
||||||
|
|
||||||
watchersGauge = prometheus.NewGauge(
|
watchingGauge = prometheus.NewGauge(
|
||||||
prometheus.GaugeOpts{
|
prometheus.GaugeOpts{
|
||||||
Namespace: "etcd",
|
Namespace: "etcd",
|
||||||
Subsystem: "storage",
|
Subsystem: "storage",
|
||||||
Name: "watchers_total",
|
Name: "watching_total",
|
||||||
Help: "Total number of watchers.",
|
Help: "Total number of watchings.",
|
||||||
})
|
})
|
||||||
|
|
||||||
slowWatchersGauge = prometheus.NewGauge(
|
slowWatchingGauge = prometheus.NewGauge(
|
||||||
prometheus.GaugeOpts{
|
prometheus.GaugeOpts{
|
||||||
Namespace: "etcd",
|
Namespace: "etcd",
|
||||||
Subsystem: "storage",
|
Subsystem: "storage",
|
||||||
Name: "slow_watchers_total",
|
Name: "slow_watching_total",
|
||||||
Help: "Total number of unsynced slow watchers.",
|
Help: "Total number of unsynced slow watchings.",
|
||||||
})
|
})
|
||||||
|
|
||||||
totalEventsCounter = prometheus.NewCounter(
|
totalEventsCounter = prometheus.NewCounter(
|
||||||
|
@ -135,9 +135,9 @@ func init() {
|
||||||
prometheus.MustRegister(deleteCounter)
|
prometheus.MustRegister(deleteCounter)
|
||||||
prometheus.MustRegister(txnCounter)
|
prometheus.MustRegister(txnCounter)
|
||||||
prometheus.MustRegister(keysGauge)
|
prometheus.MustRegister(keysGauge)
|
||||||
prometheus.MustRegister(watchersGauge)
|
prometheus.MustRegister(watchingGauge)
|
||||||
prometheus.MustRegister(totalEventsCounter)
|
prometheus.MustRegister(totalEventsCounter)
|
||||||
prometheus.MustRegister(slowWatchersGauge)
|
prometheus.MustRegister(slowWatchingGauge)
|
||||||
prometheus.MustRegister(pendingEventsGauge)
|
prometheus.MustRegister(pendingEventsGauge)
|
||||||
prometheus.MustRegister(indexCompactionPauseDurations)
|
prometheus.MustRegister(indexCompactionPauseDurations)
|
||||||
prometheus.MustRegister(dbCompactionPauseDurations)
|
prometheus.MustRegister(dbCompactionPauseDurations)
|
||||||
|
|
|
@ -186,10 +186,10 @@ func (s *watchableStore) watch(key []byte, prefix bool, startRev int64, ch chan<
|
||||||
if startRev == 0 {
|
if startRev == 0 {
|
||||||
s.synced[k] = append(s.synced[k], wa)
|
s.synced[k] = append(s.synced[k], wa)
|
||||||
} else {
|
} else {
|
||||||
slowWatchersGauge.Inc()
|
slowWatchingGauge.Inc()
|
||||||
s.unsynced[wa] = struct{}{}
|
s.unsynced[wa] = struct{}{}
|
||||||
}
|
}
|
||||||
watchersGauge.Inc()
|
watchingGauge.Inc()
|
||||||
|
|
||||||
cancel := CancelFunc(func() {
|
cancel := CancelFunc(func() {
|
||||||
s.mu.Lock()
|
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
|
// remove global references of the watching
|
||||||
if _, ok := s.unsynced[wa]; ok {
|
if _, ok := s.unsynced[wa]; ok {
|
||||||
delete(s.unsynced, wa)
|
delete(s.unsynced, wa)
|
||||||
slowWatchersGauge.Dec()
|
slowWatchingGauge.Dec()
|
||||||
watchersGauge.Dec()
|
watchingGauge.Dec()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, w := range s.synced[k] {
|
for i, w := range s.synced[k] {
|
||||||
if w == wa {
|
if w == wa {
|
||||||
s.synced[k] = append(s.synced[k][:i], s.synced[k][i+1:]...)
|
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.
|
// 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
|
// put it back to try it in the next round
|
||||||
w.cur = nextRev
|
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.
|
// 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:
|
default:
|
||||||
w.cur = rev
|
w.cur = rev
|
||||||
s.unsynced[w] = struct{}{}
|
s.unsynced[w] = struct{}{}
|
||||||
slowWatchersGauge.Inc()
|
slowWatchingGauge.Inc()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.synced[string(ev.Kv.Key[:i])] = nws
|
s.synced[string(ev.Kv.Key[:i])] = nws
|
||||||
|
|
Loading…
Reference in New Issue