mvcc: document, clean up histogram variables
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>release-3.4
parent
e6a113cdcd
commit
1d91698268
|
@ -168,7 +168,7 @@ func (s *store) Hash() (hash uint32, revision int64, err error) {
|
||||||
s.b.ForceCommit()
|
s.b.ForceCommit()
|
||||||
h, err := s.b.Hash(DefaultIgnores)
|
h, err := s.b.Hash(DefaultIgnores)
|
||||||
|
|
||||||
hashDurations.Observe(time.Since(start).Seconds())
|
hashSec.Observe(time.Since(start).Seconds())
|
||||||
return h, s.currentRev, err
|
return h, s.currentRev, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ func (s *store) HashByRev(rev int64) (hash uint32, currentRev int64, compactRev
|
||||||
})
|
})
|
||||||
hash = h.Sum32()
|
hash = h.Sum32()
|
||||||
|
|
||||||
hashRevDurations.Observe(time.Since(start).Seconds())
|
hashRevSec.Observe(time.Since(start).Seconds())
|
||||||
return hash, currentRev, compactRev, err
|
return hash, currentRev, compactRev, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ func (s *store) Compact(rev int64) (<-chan struct{}, error) {
|
||||||
|
|
||||||
s.fifoSched.Schedule(j)
|
s.fifoSched.Schedule(j)
|
||||||
|
|
||||||
indexCompactionPauseDurations.Observe(float64(time.Since(start) / time.Millisecond))
|
indexCompactionPauseMs.Observe(float64(time.Since(start) / time.Millisecond))
|
||||||
return ch, nil
|
return ch, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ import (
|
||||||
|
|
||||||
func (s *store) scheduleCompaction(compactMainRev int64, keep map[revision]struct{}) bool {
|
func (s *store) scheduleCompaction(compactMainRev int64, keep map[revision]struct{}) bool {
|
||||||
totalStart := time.Now()
|
totalStart := time.Now()
|
||||||
defer dbCompactionTotalDurations.Observe(float64(time.Since(totalStart) / time.Millisecond))
|
defer dbCompactionTotalMs.Observe(float64(time.Since(totalStart) / time.Millisecond))
|
||||||
keyCompactions := 0
|
keyCompactions := 0
|
||||||
defer func() { dbCompactionKeysCounter.Add(float64(keyCompactions)) }()
|
defer func() { dbCompactionKeysCounter.Add(float64(keyCompactions)) }()
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ func (s *store) scheduleCompaction(compactMainRev int64, keep map[revision]struc
|
||||||
// update last
|
// update last
|
||||||
revToBytes(revision{main: rev.main, sub: rev.sub + 1}, last)
|
revToBytes(revision{main: rev.main, sub: rev.sub + 1}, last)
|
||||||
tx.Unlock()
|
tx.Unlock()
|
||||||
dbCompactionPauseDurations.Observe(float64(time.Since(start) / time.Millisecond))
|
dbCompactionPauseMs.Observe(float64(time.Since(start) / time.Millisecond))
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-time.After(100 * time.Millisecond):
|
case <-time.After(100 * time.Millisecond):
|
||||||
|
|
|
@ -101,33 +101,39 @@ var (
|
||||||
Help: "Total number of pending events to be sent.",
|
Help: "Total number of pending events to be sent.",
|
||||||
})
|
})
|
||||||
|
|
||||||
indexCompactionPauseDurations = prometheus.NewHistogram(
|
indexCompactionPauseMs = prometheus.NewHistogram(
|
||||||
prometheus.HistogramOpts{
|
prometheus.HistogramOpts{
|
||||||
Namespace: "etcd_debugging",
|
Namespace: "etcd_debugging",
|
||||||
Subsystem: "mvcc",
|
Subsystem: "mvcc",
|
||||||
Name: "index_compaction_pause_duration_milliseconds",
|
Name: "index_compaction_pause_duration_milliseconds",
|
||||||
Help: "Bucketed histogram of index compaction pause duration.",
|
Help: "Bucketed histogram of index compaction pause duration.",
|
||||||
// 0.5ms -> 1second
|
|
||||||
Buckets: prometheus.ExponentialBuckets(0.5, 2, 12),
|
// lowest bucket start of upper bound 0.5 ms with factor 2
|
||||||
|
// highest bucket start of 0.5 ms * 2^13 == 4.096 sec
|
||||||
|
Buckets: prometheus.ExponentialBuckets(0.5, 2, 14),
|
||||||
})
|
})
|
||||||
|
|
||||||
dbCompactionPauseDurations = prometheus.NewHistogram(
|
dbCompactionPauseMs = prometheus.NewHistogram(
|
||||||
prometheus.HistogramOpts{
|
prometheus.HistogramOpts{
|
||||||
Namespace: "etcd_debugging",
|
Namespace: "etcd_debugging",
|
||||||
Subsystem: "mvcc",
|
Subsystem: "mvcc",
|
||||||
Name: "db_compaction_pause_duration_milliseconds",
|
Name: "db_compaction_pause_duration_milliseconds",
|
||||||
Help: "Bucketed histogram of db compaction pause duration.",
|
Help: "Bucketed histogram of db compaction pause duration.",
|
||||||
// 1ms -> 4second
|
|
||||||
|
// lowest bucket start of upper bound 1 ms with factor 2
|
||||||
|
// highest bucket start of 1 ms * 2^12 == 4.096 sec
|
||||||
Buckets: prometheus.ExponentialBuckets(1, 2, 13),
|
Buckets: prometheus.ExponentialBuckets(1, 2, 13),
|
||||||
})
|
})
|
||||||
|
|
||||||
dbCompactionTotalDurations = prometheus.NewHistogram(
|
dbCompactionTotalMs = prometheus.NewHistogram(
|
||||||
prometheus.HistogramOpts{
|
prometheus.HistogramOpts{
|
||||||
Namespace: "etcd_debugging",
|
Namespace: "etcd_debugging",
|
||||||
Subsystem: "mvcc",
|
Subsystem: "mvcc",
|
||||||
Name: "db_compaction_total_duration_milliseconds",
|
Name: "db_compaction_total_duration_milliseconds",
|
||||||
Help: "Bucketed histogram of db compaction total duration.",
|
Help: "Bucketed histogram of db compaction total duration.",
|
||||||
// 100ms -> 800second
|
|
||||||
|
// lowest bucket start of upper bound 100 ms with factor 2
|
||||||
|
// highest bucket start of 100 ms * 2^13 == 8.192 sec
|
||||||
Buckets: prometheus.ExponentialBuckets(100, 2, 14),
|
Buckets: prometheus.ExponentialBuckets(100, 2, 14),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -169,9 +175,9 @@ var (
|
||||||
)
|
)
|
||||||
// overridden by mvcc initialization
|
// overridden by mvcc initialization
|
||||||
reportDbTotalSizeInUseInBytesMu sync.RWMutex
|
reportDbTotalSizeInUseInBytesMu sync.RWMutex
|
||||||
reportDbTotalSizeInUseInBytes func() float64 = func() float64 { return 0 }
|
reportDbTotalSizeInUseInBytes = func() float64 { return 0 }
|
||||||
|
|
||||||
hashDurations = prometheus.NewHistogram(prometheus.HistogramOpts{
|
hashSec = prometheus.NewHistogram(prometheus.HistogramOpts{
|
||||||
Namespace: "etcd",
|
Namespace: "etcd",
|
||||||
Subsystem: "mvcc",
|
Subsystem: "mvcc",
|
||||||
Name: "hash_duration_seconds",
|
Name: "hash_duration_seconds",
|
||||||
|
@ -183,7 +189,7 @@ var (
|
||||||
Buckets: prometheus.ExponentialBuckets(.01, 2, 15),
|
Buckets: prometheus.ExponentialBuckets(.01, 2, 15),
|
||||||
})
|
})
|
||||||
|
|
||||||
hashRevDurations = prometheus.NewHistogram(prometheus.HistogramOpts{
|
hashRevSec = prometheus.NewHistogram(prometheus.HistogramOpts{
|
||||||
Namespace: "etcd",
|
Namespace: "etcd",
|
||||||
Subsystem: "mvcc",
|
Subsystem: "mvcc",
|
||||||
Name: "hash_rev_duration_seconds",
|
Name: "hash_rev_duration_seconds",
|
||||||
|
@ -207,14 +213,14 @@ func init() {
|
||||||
prometheus.MustRegister(slowWatcherGauge)
|
prometheus.MustRegister(slowWatcherGauge)
|
||||||
prometheus.MustRegister(totalEventsCounter)
|
prometheus.MustRegister(totalEventsCounter)
|
||||||
prometheus.MustRegister(pendingEventsGauge)
|
prometheus.MustRegister(pendingEventsGauge)
|
||||||
prometheus.MustRegister(indexCompactionPauseDurations)
|
prometheus.MustRegister(indexCompactionPauseMs)
|
||||||
prometheus.MustRegister(dbCompactionPauseDurations)
|
prometheus.MustRegister(dbCompactionPauseMs)
|
||||||
prometheus.MustRegister(dbCompactionTotalDurations)
|
prometheus.MustRegister(dbCompactionTotalMs)
|
||||||
prometheus.MustRegister(dbCompactionKeysCounter)
|
prometheus.MustRegister(dbCompactionKeysCounter)
|
||||||
prometheus.MustRegister(dbTotalSize)
|
prometheus.MustRegister(dbTotalSize)
|
||||||
prometheus.MustRegister(dbTotalSizeInUse)
|
prometheus.MustRegister(dbTotalSizeInUse)
|
||||||
prometheus.MustRegister(hashDurations)
|
prometheus.MustRegister(hashSec)
|
||||||
prometheus.MustRegister(hashRevDurations)
|
prometheus.MustRegister(hashRevSec)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReportEventReceived reports that an event is received.
|
// ReportEventReceived reports that an event is received.
|
||||||
|
|
Loading…
Reference in New Issue