Skip to content
This repository has been archived by the owner on Aug 13, 2019. It is now read-only.

Commit

Permalink
Add metrics for isolation.
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-brazil authored and gouthamve committed Mar 20, 2018
1 parent efd5bf1 commit 59ebdbd
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ type DB struct {

type dbMetrics struct {
loadedBlocks prometheus.GaugeFunc
lowWatermark prometheus.GaugeFunc
highWatermark prometheus.GaugeFunc
reloads prometheus.Counter
reloadsFailed prometheus.Counter
compactionsTriggered prometheus.Counter
Expand All @@ -150,6 +152,20 @@ func newDBMetrics(db *DB, r prometheus.Registerer) *dbMetrics {
defer db.mtx.RUnlock()
return float64(len(db.blocks))
})
m.lowWatermark = prometheus.NewGaugeFunc(prometheus.GaugeOpts{
Name: "tsdb_isolation_low_watermark",
Help: "The lowest write id that is still referenced.",
}, func() float64 {
return float64(db.readLowWatermark())
})
m.highWatermark = prometheus.NewGaugeFunc(prometheus.GaugeOpts{
Name: "tsdb_isolation_high_watermark",
Help: "The highest write id that has been given out.",
}, func() float64 {
db.writeMtx.Lock()
defer db.writeMtx.Unlock()
return float64(db.writeLastId)
})
m.reloads = prometheus.NewCounter(prometheus.CounterOpts{
Name: "prometheus_tsdb_reloads_total",
Help: "Number of times the database reloaded block data from disk.",
Expand Down Expand Up @@ -178,6 +194,8 @@ func newDBMetrics(db *DB, r prometheus.Registerer) *dbMetrics {
if r != nil {
r.MustRegister(
m.loadedBlocks,
m.lowWatermark,
m.highWatermark,
m.reloads,
m.reloadsFailed,
m.cutoffs,
Expand Down

0 comments on commit 59ebdbd

Please sign in to comment.