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