small fix on metering function

This commit is contained in:
shantichanal 2025-08-11 03:04:39 +03:00 committed by Gary Rong
parent e869586e13
commit 0f09a8c690

View file

@ -7,8 +7,8 @@ import (
)
var (
avgAccessDepthInBlock = metrics.NewRegisteredMeter("trie/access/depth/avg", nil)
minAccessDepthInBlock = metrics.NewRegisteredMeter("trie/access/depth/min", nil)
avgAccessDepthInBlock = metrics.NewRegisteredGauge("trie/access/depth/avg", nil)
minAccessDepthInBlock = metrics.NewRegisteredGauge("trie/access/depth/min", nil)
stateDepthAggregator = &depthAggregator{}
)
@ -44,8 +44,8 @@ func (d *depthAggregator) end() {
sum, cnt, min := d.sum, d.cnt, d.min
d.mu.Unlock()
if cnt > 0 {
avgAccessDepthInBlock.Mark(sum / cnt)
minAccessDepthInBlock.Mark(min)
avgAccessDepthInBlock.Update(sum / cnt)
minAccessDepthInBlock.Update(min)
}
}