From 777b1364e86727ec6e56e2cf7eb1441fd5288b3b Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Sun, 31 Mar 2024 23:52:46 -0500 Subject: [PATCH] Don't increment the gas used metric in the prefetcher --- arbos/block_processor.go | 6 ------ execution/gethexec/executionengine.go | 10 ++++++---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/arbos/block_processor.go b/arbos/block_processor.go index f1838132a8..e239efa552 100644 --- a/arbos/block_processor.go +++ b/arbos/block_processor.go @@ -25,7 +25,6 @@ import ( "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/trie" ) @@ -40,7 +39,6 @@ var L2ToL1TransactionEventID common.Hash var L2ToL1TxEventID common.Hash var EmitReedeemScheduledEvent func(*vm.EVM, uint64, uint64, [32]byte, [32]byte, common.Address, *big.Int, *big.Int) error var EmitTicketCreatedEvent func(*vm.EVM, [32]byte) error -var gasUsedSinceStartupCounter = metrics.NewRegisteredCounter("arb/gas_used", nil) // A helper struct that implements String() by marshalling to JSON. // This is useful for logging because it's lazy, so if the log level is too high to print the transaction, @@ -463,10 +461,6 @@ func ProduceBlockAdvanced( blockGasLeft = arbmath.SaturatingUSub(blockGasLeft, computeUsed) - // Add gas used since startup to prometheus metric. - gasUsed := arbmath.SaturatingUSub(receipt.GasUsed, receipt.GasUsedForL1) - gasUsedSinceStartupCounter.Inc(arbmath.SaturatingCast(gasUsed)) - complete = append(complete, tx) receipts = append(receipts, receipt) diff --git a/execution/gethexec/executionengine.go b/execution/gethexec/executionengine.go index f9e98b3a6a..00cc593de4 100644 --- a/execution/gethexec/executionengine.go +++ b/execution/gethexec/executionengine.go @@ -27,10 +27,11 @@ import ( ) var ( - baseFeeGauge = metrics.NewRegisteredGauge("arb/block/basefee", nil) - blockGasUsedHistogram = metrics.NewRegisteredHistogram("arb/block/gasused", nil, metrics.NewBoundedHistogramSample()) - txCountHistogram = metrics.NewRegisteredHistogram("arb/block/transactions/count", nil, metrics.NewBoundedHistogramSample()) - txGasUsedHistogram = metrics.NewRegisteredHistogram("arb/block/transactions/gasused", nil, metrics.NewBoundedHistogramSample()) + baseFeeGauge = metrics.NewRegisteredGauge("arb/block/basefee", nil) + blockGasUsedHistogram = metrics.NewRegisteredHistogram("arb/block/gasused", nil, metrics.NewBoundedHistogramSample()) + txCountHistogram = metrics.NewRegisteredHistogram("arb/block/transactions/count", nil, metrics.NewBoundedHistogramSample()) + txGasUsedHistogram = metrics.NewRegisteredHistogram("arb/block/transactions/gasused", nil, metrics.NewBoundedHistogramSample()) + gasUsedSinceStartupCounter = metrics.NewRegisteredCounter("arb/gas_used", nil) ) type ExecutionEngine struct { @@ -513,6 +514,7 @@ func (s *ExecutionEngine) appendBlock(block *types.Block, statedb *state.StateDB blockGasused += val } blockGasUsedHistogram.Update(int64(blockGasused)) + gasUsedSinceStartupCounter.Inc(int64(blockGasused)) return nil }