Skip to content

Conversation

@smypmsa
Copy link
Member

@smypmsa smypmsa commented Jun 12, 2025

Summary by CodeRabbit

  • New Features
    • Switched tracked WebSocket latency metric from log latency to block latency for Ethereum, Base, and Arbitrum networks.
  • Chores
    • Updated scheduled tasks for multiple API endpoints to run every 5 minutes instead of every minute.

@vercel
Copy link

vercel bot commented Jun 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
chainstack-rpc-dashboard-germany ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 12, 2025 1:25pm
chainstack-rpc-dashboard-singapore ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 12, 2025 1:25pm
chainstack-rpc-dashboard-us-west ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 12, 2025 1:25pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 12, 2025

Walkthrough

The changes swap the usage of two WebSocket latency metrics—WSBlockLatencyMetric is now used instead of WSLogLatencyMetric—in the Arbitrum, Base, and Ethereum read API modules. Additionally, the cron schedules for several read API endpoints in the Vercel configuration are updated to run every 5 minutes instead of every minute.

Changes

File(s) Change Summary
api/read/arbitrum.py, api/read/base.py, api/read/ethereum.py Swapped WSLogLatencyMetric for WSBlockLatencyMetric in imports and the METRICS list.
vercel.json Changed cron schedule for multiple read API endpoints from every minute to every 5 minutes.

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
Loading

Possibly related PRs

Poem

A hop, a skip, a metric swapped,
Block latency now is what we’ve got.
Five-minute hops for every run,
The dashboard’s work is never done.
With metrics neat and schedules tight,
This rabbit codes into the night!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

WSLogLatencyMetric is now fully superseded; leaving the commented-out line invites drift and merge conflicts later.

-from metrics.ethereum import (
-    WSBlockLatencyMetric,
-    # WSLogLatencyMetric,
-)
+from metrics.ethereum import WSBlockLatencyMetric
api/read/ethereum.py (1)

10-12: Prune the commented symbol for readability

Same 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 consistent

Pulling a Base-specific WebSocket metric from metrics.ethereum is pragmatic, but mildly confusing given the rest of the metrics come from metrics.base. Consider re-exporting WSBlockLatencyMetric inside metrics.base.__init__ to avoid cross-package leakage.

vercel.json (1)

41-68: Cron consolidation looks correct; document the rationale

Reducing 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

📥 Commits

Reviewing files that changed from the base of the PR and between 707f30d and a4ebc99.

📒 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 supports eth_subscribe / newHeads

WSBlockLatencyMetric relies on the eth_subscribe:newHeads flow. 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 lacks eth_subscribe the metric will always timeout.

api/read/ethereum.py (1)

17-18: Double-check call-site kwargs

WSBlockLatencyMetric expects an optional ws_endpoint kwarg (see metrics/ethereum.py). Verify that MetricsHandler("Ethereum", METRICS) forwards this kwarg or injects a default; otherwise the metric will connect to None and instantly fail.

api/read/base.py (1)

19-21: Validate provider compatibility

As with Ethereum and Arbitrum, ensure the Base WS endpoint supports eth_subscribe:newHeads; some Optimism-based nodes disable this.

@smypmsa smypmsa merged commit b161de4 into master Jun 12, 2025
5 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Aug 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants