mvcc: add "etcd_mvcc_db_total_size_in_bytes"

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
Gyuho Lee 2018-07-03 14:24:56 -07:00
parent 72c51d3e12
commit 1da3603e31

View File

@ -139,7 +139,7 @@ var (
Help: "Total number of db keys compacted.",
})
dbTotalSize = prometheus.NewGaugeFunc(prometheus.GaugeOpts{
dbTotalSizeDebugging = prometheus.NewGaugeFunc(prometheus.GaugeOpts{
Namespace: "etcd_debugging",
Subsystem: "mvcc",
Name: "db_total_size_in_bytes",
@ -151,9 +151,21 @@ var (
return reportDbTotalSizeInBytes()
},
)
dbTotalSize = prometheus.NewGaugeFunc(prometheus.GaugeOpts{
Namespace: "etcd",
Subsystem: "mvcc",
Name: "db_total_size_in_bytes",
Help: "Total size of the underlying database in bytes.",
},
func() float64 {
reportDbTotalSizeInBytesMu.RLock()
defer reportDbTotalSizeInBytesMu.RUnlock()
return reportDbTotalSizeInBytes()
},
)
// overridden by mvcc initialization
reportDbTotalSizeInBytesMu sync.RWMutex
reportDbTotalSizeInBytes func() float64 = func() float64 { return 0 }
reportDbTotalSizeInBytes = func() float64 { return 0 }
)
func init() {
@ -171,6 +183,7 @@ func init() {
prometheus.MustRegister(dbCompactionPauseDurations)
prometheus.MustRegister(dbCompactionTotalDurations)
prometheus.MustRegister(dbCompactionKeysCounter)
prometheus.MustRegister(dbTotalSizeDebugging)
prometheus.MustRegister(dbTotalSize)
}