RPCOperationRecorder
Documentation for eth_defi.provider.rpcdb.RPCOperationRecorder Python class.
- class RPCOperationRecorder
Bases:
objectBind a fixed operation label to an existing physical-request accumulator.
Multicall attaches this lightweight recorder to its worker-owned provider for the isolated lane. Regular and isolated recorders share the same locked counters: provider retries and verification requests are counted exactly once, without thread-local context, copied counters or a later merge step. The provider binding is restored by the reader even when a request fails. Pickling retains the label and uses the accumulator’s existing serialisation, which excludes the lock and recreates it inside the receiving process.
Attributes summary
Shared accumulator receiving both physical totals and operation breakdowns.
Fixed attribution label; does not mutate the shared phase's default label.
Methods summary
__init__(stats, operation)record_call(rpc_provider_domain, api_call[, ...])Count provider attempts using this recorder's explicit operation label.
record_error(rpc_provider_domain, ...[, count])Keep provider errors in the shared accumulator's existing breakdown.
- stats: eth_defi.provider.rpcdb.RPCRequestStats
Shared accumulator receiving both physical totals and operation breakdowns.
- operation: str
Fixed attribution label; does not mutate the shared phase’s default label.
- record_call(rpc_provider_domain, api_call, count=1)
Count provider attempts using this recorder’s explicit operation label.
The fallback provider invokes the same interface on an accumulator or a recorder. Delegating once keeps operation rows a partition of physical totals, including unsuccessful attempts and provider-switch verification.
- record_error(rpc_provider_domain, error_code, error_message, count=1)
Keep provider errors in the shared accumulator’s existing breakdown.
Error keys do not include an operation label. Forwarding them unchanged preserves the persisted schema and avoids counting one failure in both the phase accumulator and a separate lane accumulator.
- Parameters
- Returns
None; the shared error counter advances under its existing lock.
- Return type
None
- __init__(stats, operation)
- Parameters
stats (eth_defi.provider.rpcdb.RPCRequestStats) –
operation (str) –
- Return type
None