eth/downloader: add metric that tracks the throttle target ratio

This commit is contained in:
Jared Wasinger 2025-04-25 13:00:07 +08:00
parent 8b7f061b12
commit e5350c9b81
2 changed files with 3 additions and 1 deletions

View file

@ -39,4 +39,5 @@ var (
receiptTimeoutMeter = metrics.NewRegisteredMeter("eth/downloader/receipts/timeout", nil)
throttleCounter = metrics.NewRegisteredCounter("eth/downloader/throttle", nil)
blockGasSizeRatioGauge = metrics.NewRegisteredGaugeFloat64("eth/downloader/gassizeratio", nil)
)

View file

@ -333,6 +333,7 @@ func (q *queue) Results(block bool) []*fetchResult {
(1-common.StorageSize(blockCacheSizeWeight))*q.resultGasSizeRatio
}
throttleThreshold := q.resultCache.SetThrottleTarget(q.resultGasSizeRatio)
blockGasSizeRatioGauge.Update(float64(q.resultGasSizeRatio))
// With results removed from the cache, wake throttled fetchers
for _, ch := range []chan bool{q.blockWakeCh, q.receiptWakeCh} {