From 1196feec4de198bdb621a9ffb54166d20c9f1b89 Mon Sep 17 00:00:00 2001 From: Sean Liao Date: Tue, 29 Jul 2025 10:14:53 +0000 Subject: [PATCH] metrics: add chain/gas for cumulative gas usage --- core/blockchain.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/blockchain.go b/core/blockchain.go index 0b92a94b6c6a..36feeb04e66f 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -67,6 +67,7 @@ var ( chainInfoGauge = metrics.NewRegisteredGaugeInfo("chain/info", nil) chainMgaspsMeter = metrics.NewRegisteredResettingTimer("chain/mgasps", nil) + chainGasCounter = metrics.NewRegisteredCounter("chain/gas/total", nil) accountReadTimer = metrics.NewRegisteredResettingTimer("chain/account/reads", nil) accountHashTimer = metrics.NewRegisteredResettingTimer("chain/account/hashes", nil) @@ -1888,6 +1889,7 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool, makeWitness // Report the import stats before returning the various results stats.processed++ stats.usedGas += res.usedGas + chainGasCounter.Inc(int64(res.usedGas)) witness = res.witness var snapDiffItems, snapBufItems common.StorageSize