mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
ethdb/pebble: add more metrics
This commit is contained in:
parent
122e795f93
commit
515efca071
1 changed files with 42 additions and 15 deletions
|
|
@ -73,7 +73,15 @@ type Database struct {
|
||||||
nonlevel0CompGauge *metrics.Gauge // Gauge for tracking the number of table compaction in non0 level
|
nonlevel0CompGauge *metrics.Gauge // Gauge for tracking the number of table compaction in non0 level
|
||||||
seekCompGauge *metrics.Gauge // Gauge for tracking the number of table compaction caused by read opt
|
seekCompGauge *metrics.Gauge // Gauge for tracking the number of table compaction caused by read opt
|
||||||
manualMemAllocGauge *metrics.Gauge // Gauge for tracking amount of non-managed memory currently allocated
|
manualMemAllocGauge *metrics.Gauge // Gauge for tracking amount of non-managed memory currently allocated
|
||||||
|
liveMemTablesGauge *metrics.Gauge // Gauge for tracking the number of live memory tables
|
||||||
|
zombieMemTablesGauge *metrics.Gauge // Gauge for tracking the number of zombie memory tables
|
||||||
|
blockCacheHitGauge *metrics.Gauge // Gauge for tracking the number of total hit in the block cache
|
||||||
|
blockCacheMissGauge *metrics.Gauge // Gauge for tracking the number of total miss in the block cache
|
||||||
|
tableCacheHitGauge *metrics.Gauge // Gauge for tracking the number of total hit in the table cache
|
||||||
|
tableCacheMissGauge *metrics.Gauge // Gauge for tracking the number of total miss in the table cache
|
||||||
|
filterHitGauge *metrics.Gauge // Gauge for tracking the number of total hit in bloom filter
|
||||||
|
filterMissGauge *metrics.Gauge // Gauge for tracking the number of total miss in bloom filter
|
||||||
|
estimatedCompDebtGauge *metrics.Gauge // Gauge for tracking the number of bytes that need to be compacted
|
||||||
levelsGauge []*metrics.Gauge // Gauge for tracking the number of tables in levels
|
levelsGauge []*metrics.Gauge // Gauge for tracking the number of tables in levels
|
||||||
|
|
||||||
quitLock sync.RWMutex // Mutex protecting the quit channel and the closed flag
|
quitLock sync.RWMutex // Mutex protecting the quit channel and the closed flag
|
||||||
|
|
@ -276,6 +284,15 @@ func New(file string, cache int, handles int, namespace string, readonly bool) (
|
||||||
db.nonlevel0CompGauge = metrics.GetOrRegisterGauge(namespace+"compact/nonlevel0", nil)
|
db.nonlevel0CompGauge = metrics.GetOrRegisterGauge(namespace+"compact/nonlevel0", nil)
|
||||||
db.seekCompGauge = metrics.GetOrRegisterGauge(namespace+"compact/seek", nil)
|
db.seekCompGauge = metrics.GetOrRegisterGauge(namespace+"compact/seek", nil)
|
||||||
db.manualMemAllocGauge = metrics.GetOrRegisterGauge(namespace+"memory/manualalloc", nil)
|
db.manualMemAllocGauge = metrics.GetOrRegisterGauge(namespace+"memory/manualalloc", nil)
|
||||||
|
db.liveMemTablesGauge = metrics.GetOrRegisterGauge(namespace+"table/live", nil)
|
||||||
|
db.zombieMemTablesGauge = metrics.GetOrRegisterGauge(namespace+"table/zombie", nil)
|
||||||
|
db.estimatedCompDebtGauge = metrics.GetOrRegisterGauge(namespace+"compact/estimateDebt", nil)
|
||||||
|
db.blockCacheHitGauge = metrics.GetOrRegisterGauge(namespace+"cache/block/hit", nil)
|
||||||
|
db.blockCacheMissGauge = metrics.GetOrRegisterGauge(namespace+"cache/block/miss", nil)
|
||||||
|
db.tableCacheHitGauge = metrics.GetOrRegisterGauge(namespace+"cache/table/hit", nil)
|
||||||
|
db.tableCacheMissGauge = metrics.GetOrRegisterGauge(namespace+"cache/table/miss", nil)
|
||||||
|
db.filterHitGauge = metrics.GetOrRegisterGauge(namespace+"filter/hit", nil)
|
||||||
|
db.filterMissGauge = metrics.GetOrRegisterGauge(namespace+"filter/miss", nil)
|
||||||
|
|
||||||
// Start up the metrics gathering and return
|
// Start up the metrics gathering and return
|
||||||
go db.meter(metricsGatheringInterval, namespace)
|
go db.meter(metricsGatheringInterval, namespace)
|
||||||
|
|
@ -524,6 +541,16 @@ func (d *Database) meter(refresh time.Duration, namespace string) {
|
||||||
d.level0CompGauge.Update(level0CompCount)
|
d.level0CompGauge.Update(level0CompCount)
|
||||||
d.seekCompGauge.Update(stats.Compact.ReadCount)
|
d.seekCompGauge.Update(stats.Compact.ReadCount)
|
||||||
|
|
||||||
|
d.liveMemTablesGauge.Update(stats.MemTable.Count)
|
||||||
|
d.zombieMemTablesGauge.Update(stats.MemTable.ZombieCount)
|
||||||
|
d.estimatedCompDebtGauge.Update(int64(stats.Compact.EstimatedDebt))
|
||||||
|
d.tableCacheHitGauge.Update(stats.TableCache.Hits)
|
||||||
|
d.tableCacheMissGauge.Update(stats.TableCache.Misses)
|
||||||
|
d.blockCacheHitGauge.Update(stats.BlockCache.Hits)
|
||||||
|
d.blockCacheMissGauge.Update(stats.BlockCache.Misses)
|
||||||
|
d.filterHitGauge.Update(stats.Filter.Hits)
|
||||||
|
d.filterMissGauge.Update(stats.Filter.Misses)
|
||||||
|
|
||||||
for i, level := range stats.Levels {
|
for i, level := range stats.Levels {
|
||||||
// Append metrics for additional layers
|
// Append metrics for additional layers
|
||||||
if i >= len(d.levelsGauge) {
|
if i >= len(d.levelsGauge) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue