-
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
base: develop
Are you sure you want to change the base?
Conversation
WalkthroughThis update increments the patch version constant in the versioning file and introduces a new metrics gauge to monitor the finalized L2 block height within the rollup synchronization service. The gauge is registered globally and updated both at service startup and upon finalization of new L2 blocks. Additionally, the error variable related to sync height resets is reorganized into a grouped variable block alongside the new gauge declaration. Changes
Sequence Diagram(s)sequenceDiagram
participant RollupSyncService
participant Database
participant Metrics
RollupSyncService->>Database: Read last finalized L2 block (on Start)
alt If block exists
RollupSyncService->>Metrics: Update finalizedBlockGauge
end
RollupSyncService->>Database: Write new finalized L2 block (on updateRollupEvents)
RollupSyncService->>Metrics: Update finalizedBlockGauge
Suggested labels
Suggested reviewers
Poem
📜 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:
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
New Features
Chores