Skip to content

Commit f8c3d56

Browse files
authored
Fix recursion (#292)
* Fix recursion * Remove metrics from onchain web3
1 parent e2694eb commit f8c3d56

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

src/blockchain/web3_extentions/middleware.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ def add_requests_metric_middleware(web3: Web3) -> Web3:
2121

2222
def metrics_collector(make_request: Callable[[RPCEndpoint, Any], RPCResponse], w3: Web3) -> Callable[[RPCEndpoint, Any], RPCResponse]:
2323
"""Constructs a middleware which measure requests parameters"""
24-
chain_id = w3.eth.chain_id
2524

2625
def middleware(method: RPCEndpoint, params: Any) -> RPCResponse:
2726
try:
@@ -33,7 +32,6 @@ def middleware(method: RPCEndpoint, params: Any) -> RPCResponse:
3332
method=method,
3433
code=failed.status_code,
3534
domain=urlparse(web3.provider.endpoint_uri).netloc, # pyright: ignore
36-
chain_id=chain_id,
3735
).inc()
3836
raise
3937

@@ -48,7 +46,6 @@ def middleware(method: RPCEndpoint, params: Any) -> RPCResponse:
4846
method=method,
4947
code=code,
5048
domain=urlparse(web3.provider.endpoint_uri).netloc, # pyright: ignore
51-
chain_id=chain_id,
5249
).inc()
5350
return response
5451

src/metrics/metrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
ETH_RPC_REQUESTS = Counter(
111111
'eth_rpc_requests',
112112
'Total count of requests to ETH1 RPC',
113-
['method', 'code', 'domain', 'chain_id'],
113+
['method', 'code', 'domain'],
114114
namespace=PROMETHEUS_PREFIX,
115115
)
116116

src/transport/msg_providers/onchain_transport.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from typing import Callable, List, Optional
44

55
import variables
6-
from blockchain.web3_extentions.middleware import add_cache_middleware, add_requests_metric_middleware
6+
from blockchain.web3_extentions.middleware import add_cache_middleware
77
from eth_typing import ChecksumAddress
88
from eth_utils import to_bytes
99
from schema import Schema
@@ -326,4 +326,4 @@ def _parse_log(self, log: LogReceipt) -> Optional[dict]:
326326

327327
@staticmethod
328328
def create_ochain_transport_w3() -> Web3:
329-
return add_requests_metric_middleware(add_cache_middleware(Web3(FallbackProvider(variables.ONCHAIN_TRANSPORT_RPC_ENDPOINTS))))
329+
return add_cache_middleware(Web3(FallbackProvider(variables.ONCHAIN_TRANSPORT_RPC_ENDPOINTS)))

0 commit comments

Comments
 (0)