-
Notifications
You must be signed in to change notification settings - Fork 1
Use newHeads subscription for Arbitrum, Base, Ethereum #39
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 ↗︎
|
WalkthroughThe changes swap the usage of two WebSocket latency metrics— Changes
Sequence Diagram(s)sequenceDiagram
participant Scheduler as Cron Scheduler
participant API as Read API Handler
participant Metrics as Metrics Module
Scheduler->>API: Trigger (every 5 minutes)
API->>Metrics: Collect WSBlockLatencyMetric
Metrics-->>API: Return block latency data
API-->>Scheduler: Complete scheduled task
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: 0
🧹 Nitpick comments (4)
api/read/arbitrum.py (1)
12-14: Remove legacy import comments to keep the import section clean
WSLogLatencyMetricis now fully superseded; leaving the commented-out line invites drift and merge conflicts later.-from metrics.ethereum import ( - WSBlockLatencyMetric, - # WSLogLatencyMetric, -) +from metrics.ethereum import WSBlockLatencyMetricapi/read/ethereum.py (1)
10-12: Prune the commented symbol for readabilitySame rationale as in
arbitrum.py—retaining the commented import clutters the file.-from metrics.ethereum import ( - HTTPAccBalanceLatencyMetric, - ... - WSBlockLatencyMetric, - # WSLogLatencyMetric, -) +from metrics.ethereum import ( + HTTPAccBalanceLatencyMetric, + ... + WSBlockLatencyMetric, +)api/read/base.py (1)
12-14: Keep import sources consistentPulling a Base-specific WebSocket metric from
metrics.ethereumis pragmatic, but mildly confusing given the rest of the metrics come frommetrics.base. Consider re-exportingWSBlockLatencyMetricinsidemetrics.base.__init__to avoid cross-package leakage.vercel.json (1)
41-68: Cron consolidation looks correct; document the rationaleReducing cadence from 1 min to 5 min will cut invocation cost but also lowers metric granularity by 80 %. A brief comment in the repo (README or CHANGELOG) explaining the trade-off would help future maintainers.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
api/read/arbitrum.py(1 hunks)api/read/base.py(1 hunks)api/read/ethereum.py(1 hunks)vercel.json(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (3)
api/read/arbitrum.py (1)
metrics/ethereum.py (1)
WSBlockLatencyMetric(116-254)
api/read/base.py (2)
metrics/ethereum.py (1)
WSBlockLatencyMetric(116-254)config/defaults.py (1)
MetricsServiceConfig(6-42)
api/read/ethereum.py (1)
metrics/ethereum.py (1)
WSBlockLatencyMetric(116-254)
🔇 Additional comments (3)
api/read/arbitrum.py (1)
19-21: Confirm the target node supportseth_subscribe/newHeads
WSBlockLatencyMetricrelies on theeth_subscribe:newHeadsflow. Some Arbitrum providers expose only filter-based polling on HTTPS endpoints but not WS subscriptions. Please double-check the WS provider configured in production; if it lackseth_subscribethe metric will always timeout.api/read/ethereum.py (1)
17-18: Double-check call-site kwargs
WSBlockLatencyMetricexpects an optionalws_endpointkwarg (seemetrics/ethereum.py). Verify thatMetricsHandler("Ethereum", METRICS)forwards this kwarg or injects a default; otherwise the metric will connect toNoneand instantly fail.api/read/base.py (1)
19-21: Validate provider compatibilityAs with Ethereum and Arbitrum, ensure the Base WS endpoint supports
eth_subscribe:newHeads; some Optimism-based nodes disable this.
Summary by CodeRabbit