Skip to content

Commit 5a10a61

Browse files
Merge branch 'master' into remove-advancestateuptoblock-func
2 parents 98047fd + 2ab7e39 commit 5a10a61

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ethdb/pebble/pebble.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ type Database struct {
9393
commitWALRotation atomic.Int64
9494
commitWait atomic.Int64
9595

96-
levelsGauge []metrics.Gauge // Gauge for tracking the number of tables in levels
96+
level0SublevelsGauge metrics.Gauge
97+
levelsGauge []metrics.Gauge // Gauge for tracking the number of tables in levels
9798

9899
quitLock sync.RWMutex // Mutex protecting the quit channel and the closed flag
99100
quitChan chan chan error // Quit channel to stop the metrics collection before closing the database
@@ -329,6 +330,8 @@ func New(file string, cache int, handles int, namespace string, readonly bool, e
329330
db.commitWALRotationMeter = metrics.GetOrRegisterMeter(namespace+"commit/duration/walrotation", nil)
330331
db.commitWaitMeter = metrics.GetOrRegisterMeter(namespace+"commit/duration/commitwait", nil)
331332

333+
db.level0SublevelsGauge = metrics.GetOrRegisterGauge(namespace+"tables/level0/sublevels", nil)
334+
332335
// Start up the metrics gathering and return
333336
go db.meter(metricsGatheringInterval, namespace)
334337
return db, nil
@@ -650,6 +653,9 @@ func (d *Database) meter(refresh time.Duration, namespace string) {
650653
d.compDebtGauge.Update(int64(stats.Compact.EstimatedDebt))
651654
d.compInProgressGauge.Update(stats.Compact.NumInProgress)
652655

656+
if len(stats.Levels) > 0 {
657+
d.level0SublevelsGauge.Update(int64(stats.Levels[0].Sublevels))
658+
}
653659
for i, level := range stats.Levels {
654660
// Append metrics for additional layers
655661
if i >= len(d.levelsGauge) {

0 commit comments

Comments
 (0)