From 13419fa39b1bf14d38871597b90a398a57d7d0e4 Mon Sep 17 00:00:00 2001 From: odingaval Date: Tue, 24 Feb 2026 07:29:14 +0300 Subject: [PATCH] internal/ethapi: expose the eth_call gas consumption as a metric #32774 --- internal/ethapi/api.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 5fbe7db694..da6d29a45d 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -43,6 +43,7 @@ import ( "github.com/ethereum/go-ethereum/eth/tracers/logger" "github.com/ethereum/go-ethereum/internal/ethapi/override" "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/metrics" "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rlp" @@ -56,6 +57,8 @@ const estimateGasErrorRatio = 0.015 var errBlobTxNotSupported = errors.New("signing blob transactions not supported") var errSubClosed = errors.New("chain subscription closed") +var rpcGasUsedEthCall = metrics.NewRegisteredHistogram("rpc/gas_used/eth_call", nil, metrics.NewExpDecaySample(1028, 0.015)) + // EthereumAPI provides an API to access Ethereum related information. type EthereumAPI struct { b Backend @@ -784,6 +787,7 @@ func (api *BlockChainAPI) Call(ctx context.Context, args TransactionArgs, blockN if err != nil { return nil, err } + rpcGasUsedEthCall.Update(int64(result.UsedGas)) if errors.Is(result.Err, vm.ErrExecutionReverted) { return nil, newRevertError(result.Revert()) }