-
Notifications
You must be signed in to change notification settings - Fork 1
Add eth_getLogs metric #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThis update introduces the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API_Read_Handler
participant HTTPGetLogsLatencyMetric
participant RPC_Node
Client->>API_Read_Handler: Make request
API_Read_Handler->>HTTPGetLogsLatencyMetric: Collect latency metric
HTTPGetLogsLatencyMetric->>RPC_Node: Send eth_getLogs (with fixed params)
RPC_Node-->>HTTPGetLogsLatencyMetric: Respond with logs
HTTPGetLogsLatencyMetric-->>API_Read_Handler: Report latency
API_Read_Handler-->>Client: Return response
Possibly related PRs
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (8)
metrics/base.py (2)
109-110: Add missing docstring for the method property.The static analysis correctly identifies a missing docstring for the public method property.
@property def method(self) -> str: + """Return the JSON-RPC method name for this metric.""" return "eth_getLogs"
118-121: Fix line length violations.Lines 118 and 120 exceed the 88-character limit flagged by static analysis.
- "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", # USDC on Base + "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", # USDC "topics": [ - "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" # Transfer event + # Transfer event signature + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" ],metrics/bnbsc.py (2)
109-110: Add missing docstring for the method property.Static analysis correctly identifies the missing docstring.
@property def method(self) -> str: + """Return the JSON-RPC method name for this metric.""" return "eth_getLogs"
118-120: Fix line length violations.Lines 118 and 120 exceed the 88-character limit.
- "address": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", # Wrapped BNB on BSC + "address": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", # WBNB "topics": [ - "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" # Transfer event + # Transfer event signature + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" ],metrics/arbitrum.py (2)
108-110: Add missing docstring for the method property.The public property needs a docstring for consistency with other methods in the codebase.
@property def method(self) -> str: + """Return the RPC method name for eth_getLogs.""" return "eth_getLogs"
118-121: Fix line length violations.Lines exceed the 88-character limit set by the project's style guide.
- "address": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", # USDC on Arbitrum + # USDC on Arbitrum + "address": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", "topics": [ - "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" # Transfer event + # Transfer event + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" ],metrics/ethereum.py (2)
116-118: Add missing docstring for the method property.Maintain consistency with other methods in the codebase.
@property def method(self) -> str: + """Return the RPC method name for eth_getLogs.""" return "eth_getLogs"
126-129: Fix line length violation.Line 128 exceeds the 88-character limit.
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", # USDC "topics": [ - "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" # Transfer event + # Transfer event + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" ],
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
api/read/arbitrum.py(1 hunks)api/read/base.py(1 hunks)api/read/bnbsc.py(1 hunks)api/read/ethereum.py(1 hunks)metrics/arbitrum.py(1 hunks)metrics/base.py(1 hunks)metrics/bnbsc.py(1 hunks)metrics/ethereum.py(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (4)
api/read/ethereum.py (2)
metrics/ethereum.py (1)
HTTPGetLogsLatencyMetric(113-131)config/defaults.py (1)
MetricsServiceConfig(6-42)
api/read/bnbsc.py (2)
metrics/bnbsc.py (1)
HTTPGetLogsLatencyMetric(105-123)config/defaults.py (1)
MetricsServiceConfig(6-42)
metrics/arbitrum.py (2)
metrics/base.py (5)
HTTPGetLogsLatencyMetric(105-123)method(10-11)method(29-30)get_params_from_state(14-22)get_params_from_state(38-40)common/metric_types.py (1)
HttpCallLatencyMetricBase(112-235)
metrics/bnbsc.py (2)
metrics/base.py (5)
HTTPGetLogsLatencyMetric(105-123)method(10-11)method(29-30)get_params_from_state(14-22)get_params_from_state(38-40)common/metric_types.py (1)
HttpCallLatencyMetricBase(112-235)
🪛 Ruff (0.11.9)
metrics/base.py
109-109: Missing docstring in public method
(D102)
120-120: Line too long (106 > 88)
(E501)
metrics/arbitrum.py
109-109: Missing docstring in public method
(D102)
118-118: Line too long (92 > 88)
(E501)
120-120: Line too long (106 > 88)
(E501)
metrics/bnbsc.py
109-109: Missing docstring in public method
(D102)
118-118: Line too long (94 > 88)
(E501)
120-120: Line too long (106 > 88)
(E501)
metrics/ethereum.py
117-117: Missing docstring in public method
(D102)
128-128: Line too long (106 > 88)
(E501)
🔇 Additional comments (9)
metrics/base.py (1)
105-123: Well-implemented metric class following established patterns.The HTTPGetLogsLatencyMetric class correctly implements the required interface and provides appropriate parameters for monitoring USDC transfers on Base network.
metrics/bnbsc.py (1)
105-123: Solid implementation once documentation is corrected.The metric class correctly implements the required interface for BNB Smart Chain monitoring.
api/read/base.py (1)
9-9: Correctly registers the new HTTPGetLogsLatencyMetric.The import and metric registration follow the established pattern and integrate the new eth_getLogs latency monitoring for Base network.
Also applies to: 26-26
api/read/arbitrum.py (1)
9-9: Correctly registers the HTTPGetLogsLatencyMetric for Arbitrum.The changes follow the same pattern as other networks and properly integrate eth_getLogs latency monitoring.
Also applies to: 26-26
api/read/bnbsc.py (1)
9-9: Correctly registers the HTTPGetLogsLatencyMetric for BNB Smart Chain.The changes maintain consistency with the pattern used across all network-specific API handlers, properly enabling eth_getLogs latency monitoring.
Also applies to: 26-26
api/read/ethereum.py (1)
9-9: LGTM! Clean integration of the new eth_getLogs metric.The HTTPGetLogsLatencyMetric is properly imported and registered following the established pattern.
Also applies to: 24-24
metrics/arbitrum.py (1)
118-118: Confirmed native USDC address on Arbitrum One is correct
- File metrics/arbitrum.py, line 118:
“0xaf88d065e77c8cC2239327C5EDb3A432268e5831” is the official native USDC contract deployed by Circle on Arbitrum One.metrics/ethereum.py (2)
191-240: Great improvement to WebSocket subscription compatibility!The fallback logic elegantly handles providers that don't support the
Falseflag parameter in eth_subscribe, improving compatibility across different RPC providers.
126-126: USDC contract address verifiedThe USDC contract address in metrics/ethereum.py (line 126) –
0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 – matches the official Ethereum mainnet address confirmed by Circle and Etherscan. No changes required.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
metrics/bnbsc.py (1)
105-123: LGTM! Address formatting and documentation issues.The implementation correctly adds eth_getLogs latency measurement for BNB Smart Chain. The contract address and Transfer event topic are accurate for Wrapped BNB on BSC.
Apply this diff to fix formatting and add missing docstring:
class HTTPGetLogsLatencyMetric(HttpCallLatencyMetricBase): """Collects call latency for the eth_getLogs method.""" @property def method(self) -> str: + """Return the JSON-RPC method name.""" return "eth_getLogs" @staticmethod def get_params_from_state(state_data: dict) -> list: """Get parameters for Wrapped BNB transfer logs from latest block.""" return [ { "fromBlock": "latest", - "address": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", # Wrapped BNB on BSC + "address": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", # Wrapped BNB "topics": [ - "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" # Transfer event + # Transfer event signature + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" ], } ]
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
metrics/bnbsc.py(1 hunks)
🧰 Additional context used
🪛 Ruff (0.11.9)
metrics/bnbsc.py
109-109: Missing docstring in public method
(D102)
118-118: Line too long (94 > 88)
(E501)
120-120: Line too long (106 > 88)
(E501)
Summary by CodeRabbit
New Features
eth_getLogsmethod for Arbitrum, Base, BNB Smart Chain, and Ethereum networks.Improvements
Removals