Skip to content

Commit

Permalink
Get chain_id on initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
hweawer committed Dec 16, 2024
1 parent 7e22902 commit c18fdb8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/blockchain/web3_extentions/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ def add_requests_metric_middleware(web3: Web3) -> Web3:
ETH_RPC_REQUESTS_DURATION - HISTOGRAM with requests time.
ETH_RPC_REQUESTS - Counter with requests count, response codes and request domain.
"""
chain_id = web3.eth.chain_id

def metrics_collector(make_request: Callable[[RPCEndpoint, Any], RPCResponse], w3: Web3) -> Callable[[RPCEndpoint, Any], RPCResponse]:
"""Constructs a middleware which measure requests parameters"""
chain_id = w3.eth.chain_id
metrics = ETH_RPC_REQUESTS
if chain_id != 1:
metrics = ONCHAIN_TRANSPORT_ETH_RPC_REQUESTS
Expand Down

0 comments on commit c18fdb8

Please # to comment.