metrics: hide checkpoint lag for failed changefeeds#5654
Conversation
Signed-off-by: Ziqian Qin <eke@fastmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Warning Review limit reached
Next review available in: 47 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
|
There was a problem hiding this comment.
Code Review
This pull request refactors the metrics collection logic in the coordinator controller. Specifically, updateChangefeedCheckpointMetrics has been updated to no longer return a boolean value, and it now handles the StateFailed state in addition to other inactive states (StateStopped, StateFinished, StateRemoved) by deleting the changefeed checkpoint metrics. The corresponding unit tests have been updated and expanded to cover all of these inactive states. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull request overview
This PR fixes misleading owner checkpoint lag reporting by deleting checkpoint timestamp/lag metrics when a changefeed enters a non-running terminal state (most importantly failed), preventing lag from continuously growing based on PD time when replication has stopped.
Changes:
- Delete changefeed checkpoint timestamp and lag metrics when the changefeed state is
failed(in addition to already-handledstopped/finished/removed). - Decouple checkpoint metric updates from error-metric synchronization so failed changefeed error information continues to be published.
- Expand the unit test to validate checkpoint metric deletion across inactive states (
failed/stopped/finished/removed).
Validation:
- Not run in this review environment (PR description lists targeted
go testandmake unit_test_pkgruns).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
coordinator/controller.go |
Deletes checkpoint metrics for failed changefeeds and ensures error-metric sync still runs. |
coordinator/controller_test.go |
Extends checkpoint-metric deletion test coverage for inactive changefeed states. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
What problem does this PR solve?
Issue Number: close #4053
A failed changefeed no longer advances its checkpoint, but the coordinator kept
publishing checkpoint lag based on the current PD time. As a result, the lag
continued to grow even though it no longer represented active replication
latency.
What is changed and how it works?
metric synchronization, so failed changefeed error information is still
reported.
removed changefeeds.
Check List
Tests
go test ./coordinator -run '^TestUpdateChangefeedCheckpointMetricsDeletesInactiveLabels$' -count=1go test ./pkg/metrics -count=1go test ./coordinator -count=1make unit_test_pkg PKG=./coordinatorQuestions
Will it cause performance regression or break compatibility?
No.
Do you need to update user documentation, design documentation or monitoring documentation?
No. The existing dashboard query stops showing the series after Prometheus
marks the deleted metric stale.
Release note