Repository navigation
Conversation
- Clear the lag alert state when the replica's master link is not up or the node is promoted, since no recovery sample can arrive then - Key the lag alert per connection so one replica cannot latch or clear another's alert - Add WebhookDispatcherService.clearThresholdAlert Fixes #538 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
Good fix for #538 — the per-connection key and the clear primitive are the right shape, and the root-cause writeup made this easy to review. A few gaps at the edges of the fix, plus one regression worth closing before merge. 1. The else-clear also fires when the link is up but the lag field is merely unparsable ( The dispatch condition is 2. The That branch calls 3. Connection removal/retirement never clears the latch (
4. The same global-key bug is still live in four sibling alerts (fast-follow, not this PR)
5. The optional-connectionId fallback is dead code that invites the bug back ( Every caller passes an id, and the siblings ( 6. No test drives the motivating sequence ( Each test does a single poll against a fresh service; fire → clear → re-fire is only proven inside the dispatcher spec with a hand-built Also noting non-blocking: declaring |
Summary
Fixes #538.
replication.lagwas only dispatched whilemaster_link_statuswasup. If the link dropped while lag was above the threshold, the fired alert never saw a recovery sample and stayed latched until the 24h state TTL, so a later lag episode on the same replica would not alert.The alert state is now cleared whenever no meaningful lag sample can arrive: the master link is not up, or the node has been promoted to primary. A new episode after the link returns fires a fresh alert.
The lag alert key was also global (
replication_lag), so one replica's lag latched the alert for every connection. With clearing added that would also let a healthy primary wipe another replica's live alert, so the key is now per connection (replication_lag:<connectionId>), matching newer threshold alerts such asscaling_readiness_low.Changes
WebhookDispatcherService.clearThresholdAlert(alertKey)drops a latched alert stateWebhookEventsProService.clearReplicationLag(connectionId)and a per-connection lag alert key;clearReplicationLagadded toIWebhookEventsProServicePrometheusServiceclears the lag alert when a replica's link is not up and when the node reportsrole:masterChecklist
roborev review --branchor/roborev-review-branchin Claude Code (internal)🤖 Generated with Claude Code
Note
Medium Risk
Changes replication lag alerting and hysteresis keys in the metrics poll path; incorrect clearing could miss or duplicate alerts, but scope is limited to PRO replication.lag webhooks with new tests.
Overview
Fixes stuck
replication.lagwebhook alerts when lag stops being observable (master link down or replica promoted) and cross-connection alert coupling from a single global hysteresis key.WebhookDispatcherServiceaddsclearThresholdAlertso latched threshold state can be dropped without a sub-threshold “recovery” sample—needed because lag samples are only sent whilemaster_link_statusisup.WebhookEventsProServicekeys lag alerts per connection (replication_lag:<connectionId>instead ofreplication_lag) and exposesclearReplicationLagon the shared Pro interface.PrometheusServicecalls clear when the node reportsrole: masteror when a replica’s master link is not up (no dispatch path).Unit tests cover dispatcher clear/re-fire behavior, Pro dispatch/clear keys, and Prometheus metric update wiring.
Reviewed by Cursor Bugbot for commit d16ceb1. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit