diff --git a/trie/triedb/pathdb/metrics.go b/trie/triedb/pathdb/metrics.go index ee91e5dc20..deffa788fd 100644 --- a/trie/triedb/pathdb/metrics.go +++ b/trie/triedb/pathdb/metrics.go @@ -61,4 +61,12 @@ var ( baseNodeBufferDifflayerAvgSize = metrics.NewRegisteredGauge("pathdb/basenodebuffer/difflayeravgsize", nil) proposedBlockReaderSuccess = metrics.NewRegisteredMeter("pathdb/nodebufferlist/proposedblockreader/success", nil) proposedBlockReaderMismatch = metrics.NewRegisteredMeter("pathdb/nodebufferlist/proposedblockreader/mismatch", nil) + + // temp metrics for test purpose + nblCountGauge = metrics.NewRegisteredGauge("pathdb/nbl/count", nil) + nblLayersGauge = metrics.NewRegisteredGauge("pathdb/nbl/layers", nil) + nblPersistIDGauge = metrics.NewRegisteredGauge("pathdb/nbl/persistid", nil) + nblPrePersistIDGauge = metrics.NewRegisteredGauge("pathdb/nbl/prepersistid", nil) + nblBaseLayersGauge = metrics.NewRegisteredGauge("pathdb/nbl/baselayers", nil) + nblPreBaseLayersGauge = metrics.NewRegisteredGauge("pathdb/nbl/prebaselayers", nil) ) diff --git a/trie/triedb/pathdb/nodebufferlist.go b/trie/triedb/pathdb/nodebufferlist.go index c66e3916d2..cac36d80bc 100644 --- a/trie/triedb/pathdb/nodebufferlist.go +++ b/trie/triedb/pathdb/nodebufferlist.go @@ -281,8 +281,8 @@ func (nf *nodebufferlist) flush(db ethdb.KeyValueStore, clean *fastcache.Cache, } nf.traverseReverse(commitFunc) // delete after testing - //prePersistID := nf.persistID - //preBaseLayes := nf.base.layers + prePersistID := nf.persistID + preBaseLayers := nf.base.layers persistID := nf.persistID + nf.base.layers err := nf.base.flush(nf.db, nf.clean, persistID) if err != nil { @@ -291,6 +291,13 @@ func (nf *nodebufferlist) flush(db ethdb.KeyValueStore, clean *fastcache.Cache, nf.isFlushing.Store(false) nf.base.reset() nf.persistID = persistID + + nblCountGauge.Update(int64(nf.count)) + nblLayersGauge.Update(int64(nf.layers)) + nblPersistIDGauge.Update(int64(nf.persistID)) + nblPrePersistIDGauge.Update(int64(prePersistID)) + nblBaseLayersGauge.Update(int64(nf.base.layers)) + nblPreBaseLayersGauge.Update(int64(preBaseLayers)) // add metrics, delete after testing // 1. nf.count nf.layers => Guard type // 2. nf.persistID prePersistID => Guard type