mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #10968 from gyuho/mmm
mvcc: add "etcd_mvcc_range_total", "etcd_mvcc_txn_total"
This commit is contained in:
commit
b679c12a51
@ -348,9 +348,9 @@ func (s *store) restore() error {
|
||||
reportDbTotalSizeInBytesMu.Lock()
|
||||
reportDbTotalSizeInBytes = func() float64 { return float64(b.Size()) }
|
||||
reportDbTotalSizeInBytesMu.Unlock()
|
||||
reportDbTotalSizeInBytesDebuggingMu.Lock()
|
||||
reportDbTotalSizeInBytesDebugging = func() float64 { return float64(b.Size()) }
|
||||
reportDbTotalSizeInBytesDebuggingMu.Unlock()
|
||||
reportDbTotalSizeInBytesDebugMu.Lock()
|
||||
reportDbTotalSizeInBytesDebug = func() float64 { return float64(b.Size()) }
|
||||
reportDbTotalSizeInBytesDebugMu.Unlock()
|
||||
reportDbTotalSizeInUseInBytesMu.Lock()
|
||||
reportDbTotalSizeInUseInBytes = func() float64 { return float64(b.SizeInUse()) }
|
||||
reportDbTotalSizeInUseInBytesMu.Unlock()
|
||||
|
@ -22,6 +22,13 @@ import (
|
||||
|
||||
var (
|
||||
rangeCounter = prometheus.NewCounter(
|
||||
prometheus.CounterOpts{
|
||||
Namespace: "etcd",
|
||||
Subsystem: "mvcc",
|
||||
Name: "range_total",
|
||||
Help: "Total number of ranges seen by this member.",
|
||||
})
|
||||
rangeCounterDebug = prometheus.NewCounter(
|
||||
prometheus.CounterOpts{
|
||||
Namespace: "etcd_debugging",
|
||||
Subsystem: "mvcc",
|
||||
@ -36,7 +43,6 @@ var (
|
||||
Name: "put_total",
|
||||
Help: "Total number of puts seen by this member.",
|
||||
})
|
||||
|
||||
// TODO: remove in 3.5 release
|
||||
putCounterDebug = prometheus.NewCounter(
|
||||
prometheus.CounterOpts{
|
||||
@ -53,7 +59,6 @@ var (
|
||||
Name: "delete_total",
|
||||
Help: "Total number of deletes seen by this member.",
|
||||
})
|
||||
|
||||
// TODO: remove in 3.5 release
|
||||
deleteCounterDebug = prometheus.NewCounter(
|
||||
prometheus.CounterOpts{
|
||||
@ -64,6 +69,13 @@ var (
|
||||
})
|
||||
|
||||
txnCounter = prometheus.NewCounter(
|
||||
prometheus.CounterOpts{
|
||||
Namespace: "etcd",
|
||||
Subsystem: "mvcc",
|
||||
Name: "txn_total",
|
||||
Help: "Total number of txns seen by this member.",
|
||||
})
|
||||
txnCounterDebug = prometheus.NewCounter(
|
||||
prometheus.CounterOpts{
|
||||
Namespace: "etcd_debugging",
|
||||
Subsystem: "mvcc",
|
||||
@ -180,21 +192,21 @@ var (
|
||||
reportDbTotalSizeInBytes = func() float64 { return 0 }
|
||||
|
||||
// TODO: remove this in v3.5
|
||||
dbTotalSizeDebugging = prometheus.NewGaugeFunc(prometheus.GaugeOpts{
|
||||
dbTotalSizeDebug = prometheus.NewGaugeFunc(prometheus.GaugeOpts{
|
||||
Namespace: "etcd_debugging",
|
||||
Subsystem: "mvcc",
|
||||
Name: "db_total_size_in_bytes",
|
||||
Help: "Total size of the underlying database physically allocated in bytes.",
|
||||
},
|
||||
func() float64 {
|
||||
reportDbTotalSizeInBytesDebuggingMu.RLock()
|
||||
defer reportDbTotalSizeInBytesDebuggingMu.RUnlock()
|
||||
return reportDbTotalSizeInBytesDebugging()
|
||||
reportDbTotalSizeInBytesDebugMu.RLock()
|
||||
defer reportDbTotalSizeInBytesDebugMu.RUnlock()
|
||||
return reportDbTotalSizeInBytesDebug()
|
||||
},
|
||||
)
|
||||
// overridden by mvcc initialization
|
||||
reportDbTotalSizeInBytesDebuggingMu sync.RWMutex
|
||||
reportDbTotalSizeInBytesDebugging = func() float64 { return 0 }
|
||||
reportDbTotalSizeInBytesDebugMu sync.RWMutex
|
||||
reportDbTotalSizeInBytesDebug = func() float64 { return 0 }
|
||||
|
||||
dbTotalSizeInUse = prometheus.NewGaugeFunc(prometheus.GaugeOpts{
|
||||
Namespace: "etcd",
|
||||
@ -256,9 +268,13 @@ var (
|
||||
|
||||
func init() {
|
||||
prometheus.MustRegister(rangeCounter)
|
||||
prometheus.MustRegister(rangeCounterDebug)
|
||||
prometheus.MustRegister(putCounter)
|
||||
prometheus.MustRegister(putCounterDebug)
|
||||
prometheus.MustRegister(deleteCounter)
|
||||
prometheus.MustRegister(deleteCounterDebug)
|
||||
prometheus.MustRegister(txnCounter)
|
||||
prometheus.MustRegister(txnCounterDebug)
|
||||
prometheus.MustRegister(keysGauge)
|
||||
prometheus.MustRegister(watchStreamGauge)
|
||||
prometheus.MustRegister(watcherGauge)
|
||||
@ -270,7 +286,7 @@ func init() {
|
||||
prometheus.MustRegister(dbCompactionTotalMs)
|
||||
prometheus.MustRegister(dbCompactionKeysCounter)
|
||||
prometheus.MustRegister(dbTotalSize)
|
||||
prometheus.MustRegister(dbTotalSizeDebugging)
|
||||
prometheus.MustRegister(dbTotalSizeDebug)
|
||||
prometheus.MustRegister(dbTotalSizeInUse)
|
||||
prometheus.MustRegister(dbOpenReadTxN)
|
||||
prometheus.MustRegister(hashSec)
|
||||
|
@ -50,12 +50,18 @@ func (tw *metricsTxnWrite) End() {
|
||||
defer tw.TxnWrite.End()
|
||||
if sum := tw.ranges + tw.puts + tw.deletes; sum > 1 {
|
||||
txnCounter.Inc()
|
||||
txnCounterDebug.Inc() // TODO: remove in 3.5 release
|
||||
}
|
||||
rangeCounter.Add(float64(tw.ranges))
|
||||
putCounter.Add(float64(tw.puts))
|
||||
// TODO: remove in 3.5 release
|
||||
putCounterDebug.Add(float64(tw.puts))
|
||||
deleteCounter.Add(float64(tw.deletes))
|
||||
// TODO: remove in 3.5 release
|
||||
deleteCounterDebug.Add(float64(tw.deletes))
|
||||
|
||||
ranges := float64(tw.ranges)
|
||||
rangeCounter.Add(ranges)
|
||||
rangeCounterDebug.Add(ranges) // TODO: remove in 3.5 release
|
||||
|
||||
puts := float64(tw.puts)
|
||||
putCounter.Add(puts)
|
||||
putCounterDebug.Add(puts) // TODO: remove in 3.5 release
|
||||
|
||||
deletes := float64(tw.deletes)
|
||||
deleteCounter.Add(deletes)
|
||||
deleteCounterDebug.Add(deletes) // TODO: remove in 3.5 release
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user