-
Notifications
You must be signed in to change notification settings - Fork 282
feat: add metrics finalized block #1172
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
WalkthroughA new metrics gauge, Changes
Sequence Diagram(s)sequenceDiagram
participant Service as RollupSyncService
participant DB as Database
participant Metrics as finalizedBlockGauge
Service->>DB: Read last finalized L2 block on Start()
alt If value present
Service->>Metrics: Update gauge with block number
end
loop On updateRollupEvents
Service->>DB: Write highest finalized L2 block
Service->>Metrics: Update gauge with new value
end
Poem
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Note ⚡️ Faster reviews with cachingCodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (2)
✨ 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 (1)
rollup/rollup_sync_service/rollup_sync_service.go (1)
49-49
: Error string should be lowercase and descriptive.
Go error strings should not start with the type name or be capitalized. Consider changing the message to a lower-case sentence:- ErrShouldResetSyncHeight = errors.New("ErrShouldResetSyncHeight") + ErrShouldResetSyncHeight = errors.New("should reset sync height")
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
params/version.go
(1 hunks)rollup/rollup_sync_service/rollup_sync_service.go
(4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: test
- GitHub Check: Analyze (go)
- GitHub Check: build-and-push
🔇 Additional comments (5)
params/version.go (1)
27-27
: Version bump approved.
The patch version constant is correctly incremented from 39 to 40, reflecting the addition of the new finalized block metric without introducing breaking changes.rollup/rollup_sync_service/rollup_sync_service.go (4)
20-20
: Metrics import added correctly.
Themetrics
package import enables gauge registration for finalized block heights. No conflicts detected with existing imports.
48-48
: Finalize gauge declared and registered.
ThefinalizedBlockGauge
is registered globally under"chain/head/finalized"
, which aligns with other chain metrics naming conventions.
144-147
: Initialize gauge on service start.
Loading the last finalized L2 block number at startup and immediately updating the gauge ensures metrics continuity across restarts. This correctly handles thenil
case.
335-335
: Update gauge upon finalization.
UpdatingfinalizedBlockGauge
after writing the new highest finalized block number ensures real-time metric accuracy for eachFinalizeBatch
event.
1. Purpose or design rationale of this PR
add metrics
chain/head/finalized
2. PR title
Your PR title must follow conventional commits (as we are doing squash merge for each PR), so it must start with one of the following types:
3. Deployment tag versioning
Has the version in
params/version.go
been updated?4. Breaking change label
Does this PR have the
breaking-change
label?Summary by CodeRabbit