2019-02-15 10:36:48 +03:00
|
|
|
package mapblockaccessor
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
getCacheHitCount = prometheus.NewCounter(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Name: "dbcache_hit_count",
|
|
|
|
Help: "Count of db cache hits",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
getCacheMissCount = prometheus.NewCounter(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Name: "dbcache_miss_count",
|
|
|
|
Help: "Count of db cache miss",
|
|
|
|
},
|
|
|
|
)
|
2019-03-13 12:41:37 +03:00
|
|
|
cacheBlockCount = prometheus.NewCounter(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Name: "dbcache_block_count",
|
|
|
|
Help: "Count of db blocks inserted",
|
|
|
|
},
|
|
|
|
)
|
2019-03-22 14:57:04 +03:00
|
|
|
changedBlockCount = prometheus.NewCounter(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Name: "changed_block_count",
|
|
|
|
Help: "Count of db blocks changed (database)",
|
|
|
|
},
|
|
|
|
)
|
2019-03-13 12:41:37 +03:00
|
|
|
cacheBlocks = prometheus.NewGauge(
|
|
|
|
prometheus.GaugeOpts{
|
|
|
|
Name: "dbcache_blocks",
|
|
|
|
Help: "Block count currently in the cache",
|
|
|
|
},
|
|
|
|
)
|
2019-02-15 10:36:48 +03:00
|
|
|
dbGetDuration = prometheus.NewHistogram(prometheus.HistogramOpts{
|
|
|
|
Name: "db_get_duration",
|
|
|
|
Help: "Histogram for db mapblock get durations",
|
|
|
|
Buckets: prometheus.LinearBuckets(0.001, 0.005, 10),
|
|
|
|
})
|
|
|
|
dbGetMtimeDuration = prometheus.NewHistogram(prometheus.HistogramOpts{
|
|
|
|
Name: "db_getmtime_duration",
|
|
|
|
Help: "Histogram for db mapblock get-by-mtime durations",
|
|
|
|
Buckets: prometheus.LinearBuckets(0.01, 0.01, 10),
|
|
|
|
})
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
prometheus.MustRegister(getCacheHitCount)
|
|
|
|
prometheus.MustRegister(getCacheMissCount)
|
|
|
|
|
2019-03-13 12:41:37 +03:00
|
|
|
prometheus.MustRegister(cacheBlockCount)
|
|
|
|
prometheus.MustRegister(cacheBlocks)
|
|
|
|
|
2019-03-22 14:57:04 +03:00
|
|
|
prometheus.MustRegister(changedBlockCount)
|
|
|
|
|
2019-02-15 10:36:48 +03:00
|
|
|
prometheus.MustRegister(dbGetDuration)
|
|
|
|
prometheus.MustRegister(dbGetMtimeDuration)
|
|
|
|
}
|