RPCRequestStats
Documentation for eth_defi.provider.rpcdb.RPCRequestStats Python class.
- class RPCRequestStats
Bases:
objectThread-safe, pickle-safe physical JSON-RPC request counters.
callsis keyed by(rpc_provider_domain, api_call)anderrorsby(rpc_provider_domain, error_code, error_message). The lock is excluded from pickle state and recreated in subprocesses.Attributes summary
Provider-domain and JSON-RPC method counts.
Provider-domain, error-code and error-message counts.
Methods summary
__init__([calls, errors])export()Take a detached copy of both counter mappings.
merge(other)Merge another worker or phase aggregate exactly once.
record_call(rpc_provider_domain, api_call[, ...])Record physical JSON-RPC request attempts.
record_error(rpc_provider_domain, ...[, count])Record JSON-RPC request failures.
- calls: collections.Counter[tuple[str, str]]
Provider-domain and JSON-RPC method counts.
- errors: collections.Counter[tuple[str, str, str]]
Provider-domain, error-code and error-message counts.
- record_call(rpc_provider_domain, api_call, count=1)
Record physical JSON-RPC request attempts.
- record_error(rpc_provider_domain, error_code, error_message, count=1)
Record JSON-RPC request failures.
- merge(other)
Merge another worker or phase aggregate exactly once.
- Parameters
other (eth_defi.provider.rpcdb.RPCRequestStats) – Detached task statistics to add to this accumulator.
- Return type
None
- export()
Take a detached copy of both counter mappings.
- Returns
Copied call and error counters safe to iterate without holding the accumulator lock.
- Return type
tuple[collections.Counter[tuple[str, str]], collections.Counter[tuple[str, str, str]]]
- __init__(calls=<factory>, errors=<factory>)
- Parameters
calls (collections.Counter[tuple[str, str]]) –
errors (collections.Counter[tuple[str, str, str]]) –
- Return type
None