Skip to content

Commit

Permalink
chore: add more metrics for debug
Browse files Browse the repository at this point in the history
  • Loading branch information
will@2012 committed Mar 6, 2024
1 parent 386cc32 commit fb27764
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions trie/triedb/pathdb/asyncnodebuffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ func (nc *nodecache) commit(nodes map[common.Hash]map[string]*trienode.Node) err
}
nc.updateSize(delta)
nc.layers++
frontBufferDeltaMeter.Mark(delta)
gcNodesMeter.Mark(overwrite)
gcBytesMeter.Mark(overwriteSize)
return nil
Expand Down Expand Up @@ -321,6 +322,7 @@ func (nc *nodecache) flush(db ethdb.KeyValueStore, clean *fastcache.Cache, id ui
if err := batch.Write(); err != nil {
return err
}
backCommitlayerNumberMeter.Update(int64(nc.layers))
commitBytesMeter.Mark(int64(size))
commitNodesMeter.Mark(int64(nodes))
commitTimeTimer.UpdateSince(start)
Expand Down
1 change: 1 addition & 0 deletions trie/triedb/pathdb/layertree.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ func (tree *layerTree) cap(root common.Hash, layers int) error {
remove(root)
}
}
layerNumberMeter.Update(int64(len(tree.layers)))
return nil
}

Expand Down
4 changes: 4 additions & 0 deletions trie/triedb/pathdb/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,8 @@ var (
historyBuildTimeMeter = metrics.NewRegisteredTimer("pathdb/history/time", nil)
historyDataBytesMeter = metrics.NewRegisteredMeter("pathdb/history/bytes/data", nil)
historyIndexBytesMeter = metrics.NewRegisteredMeter("pathdb/history/bytes/index", nil)

layerNumberMeter = metrics.NewRegisteredGauge("pathdb/layer/number", nil)
frontBufferDeltaMeter = metrics.NewRegisteredMeter("pathdb/front/buffer/delta", nil)
backCommitlayerNumberMeter = metrics.NewRegisteredGauge("pathdb/back/commit/layer/number", nil)
)

0 comments on commit fb27764

Please sign in to comment.