mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
metrics: add chain/gas for cumulative gas usage
This is a followup to #31753. A cumulative counter is more useful when we need to measure / aggregate the metric over a longer peruid of time. It also means we won't miss data, e.g. our prometheus scrapes every 30 seconds, and so may miss a transient spike in the preaggregated mgas/s.
This commit is contained in:
parent
23f07d8c93
commit
f1eee7f7f5
1 changed files with 2 additions and 0 deletions
|
|
@ -67,6 +67,7 @@ var (
|
||||||
|
|
||||||
chainInfoGauge = metrics.NewRegisteredGaugeInfo("chain/info", nil)
|
chainInfoGauge = metrics.NewRegisteredGaugeInfo("chain/info", nil)
|
||||||
chainMgaspsGauge = metrics.NewRegisteredGauge("chain/mgasps", nil)
|
chainMgaspsGauge = metrics.NewRegisteredGauge("chain/mgasps", nil)
|
||||||
|
chainGasCounter = metrics.NewRegisteredCounter("chain/gas/total", nil)
|
||||||
|
|
||||||
accountReadTimer = metrics.NewRegisteredResettingTimer("chain/account/reads", nil)
|
accountReadTimer = metrics.NewRegisteredResettingTimer("chain/account/reads", nil)
|
||||||
accountHashTimer = metrics.NewRegisteredResettingTimer("chain/account/hashes", nil)
|
accountHashTimer = metrics.NewRegisteredResettingTimer("chain/account/hashes", nil)
|
||||||
|
|
@ -1844,6 +1845,7 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool, makeWitness
|
||||||
// Report the import stats before returning the various results
|
// Report the import stats before returning the various results
|
||||||
stats.processed++
|
stats.processed++
|
||||||
stats.usedGas += res.usedGas
|
stats.usedGas += res.usedGas
|
||||||
|
chainGasCounter.Inc(int64(res.usedGas))
|
||||||
witness = res.witness
|
witness = res.witness
|
||||||
|
|
||||||
var snapDiffItems, snapBufItems common.StorageSize
|
var snapDiffItems, snapBufItems common.StorageSize
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue