From e5350c9b81fe10309a8e5d0e1265f43896d2bdd3 Mon Sep 17 00:00:00 2001 From: Jared Wasinger Date: Fri, 25 Apr 2025 13:00:07 +0800 Subject: [PATCH] eth/downloader: add metric that tracks the throttle target ratio --- eth/downloader/metrics.go | 3 ++- eth/downloader/queue.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/eth/downloader/metrics.go b/eth/downloader/metrics.go index 608b39828b..4965f4d0c8 100644 --- a/eth/downloader/metrics.go +++ b/eth/downloader/metrics.go @@ -38,5 +38,6 @@ var ( receiptDropMeter = metrics.NewRegisteredMeter("eth/downloader/receipts/drop", nil) receiptTimeoutMeter = metrics.NewRegisteredMeter("eth/downloader/receipts/timeout", nil) - throttleCounter = metrics.NewRegisteredCounter("eth/downloader/throttle", nil) + throttleCounter = metrics.NewRegisteredCounter("eth/downloader/throttle", nil) + blockGasSizeRatioGauge = metrics.NewRegisteredGaugeFloat64("eth/downloader/gassizeratio", nil) ) diff --git a/eth/downloader/queue.go b/eth/downloader/queue.go index 8a117f1f7d..9b93c1c7f7 100644 --- a/eth/downloader/queue.go +++ b/eth/downloader/queue.go @@ -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} {