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 13:48:38 -07:00
parent c2623bb840
commit 5531e3b0f5
2 changed files with 12 additions and 3 deletions

View File

@ -217,7 +217,9 @@ func (s *store) txnEnd(txnID int64) error {
}
s.currentRev.sub = 0
dbTotalSize.Set(float64(s.b.Size()))
dbSize := float64(s.b.Size())
dbTotalSizeDebugging.Set(dbSize)
dbTotalSize.Set(dbSize)
s.mu.Unlock()
return nil
}

View File

@ -129,11 +129,17 @@ var (
Buckets: prometheus.ExponentialBuckets(100, 2, 14),
})
dbTotalSize = prometheus.NewGauge(prometheus.GaugeOpts{
dbTotalSizeDebugging = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: "etcd_debugging",
Subsystem: "mvcc",
Name: "db_total_size_in_bytes",
Help: "Total size of the underlying database in bytes.",
Help: "Total size of the underlying database physically allocated in bytes. Use etcd_mvcc_db_total_size_in_bytes",
})
dbTotalSize = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: "etcd",
Subsystem: "mvcc",
Name: "db_total_size_in_bytes",
Help: "Total size of the underlying database physically allocated in bytes.",
})
)
@ -151,6 +157,7 @@ func init() {
prometheus.MustRegister(indexCompactionPauseDurations)
prometheus.MustRegister(dbCompactionPauseDurations)
prometheus.MustRegister(dbCompactionTotalDurations)
prometheus.MustRegister(dbTotalSizeDebugging)
prometheus.MustRegister(dbTotalSize)
}