Skip to content

Commit

Permalink
add gas used metric
Browse files Browse the repository at this point in the history
  • Loading branch information
ganeshvanahalli committed Jul 14, 2023
1 parent 5523970 commit 823d927
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions arbos/block_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ 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"
)
Expand All @@ -39,6 +40,7 @@ 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/sequencer/gasused", nil)

type L1Info struct {
poster common.Address
Expand Down Expand Up @@ -422,6 +424,10 @@ func ProduceBlockAdvanced(
blockGasLeft = 0
}

// 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)

Expand Down

0 comments on commit 823d927

Please sign in to comment.