feat(alerts): add re-notify interval as option, stop notifying on every evaluation - #2754
feat(alerts): add re-notify interval as option, stop notifying on every evaluation#2754niladrix719 wants to merge 5 commits into
Conversation
Signed-off-by: Niladri Adhikary <niladrix719@gmail.com>
|
@niladrix719 is attempting to deploy a commit to the HyperDX Team on Vercel. A member of the Team first needs to authorize it. |
🦋 Changeset detectedLatest commit: c316ffa The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Greptile SummaryAdds configurable repeat notifications for firing alerts.
Confidence Score: 5/5The PR appears safe to merge. The previously reported delivery-failure issue is resolved because failed or silenced sends now return false, and both firing paths update lastNotifiedAt only after a successful send, leaving the next evaluation eligible to retry.
|
| Filename | Overview |
|---|---|
| packages/api/src/tasks/checkAlerts/index.ts | Adds successful-delivery-aware notification timing and interval gating for grouped and ungrouped alerts. |
| packages/api/src/models/alertHistory.ts | Persists the timestamp of the most recent successful firing notification. |
| packages/api/src/models/alert.ts | Adds the non-negative optional re-notification interval to the alert model. |
| packages/api/src/tasks/checkAlerts/tests/checkAlerts.int.test.ts | Covers transition-only, every-evaluation, timed repeat, and renewed post-resolution notification behavior. |
| packages/app/src/components/AlertScheduleFields.tsx | Adds the advanced re-notification interval input and its user-facing behavior guidance. |
| packages/common-utils/src/types.ts | Extends shared alert schemas with the nullable non-negative interval field. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
E[Alert evaluation breaches threshold] --> U{Unresolved notification exists?}
U -->|No| S[Send firing notification]
U -->|Yes| R{Re-notify setting}
R -->|Unset| K[Skip repeat]
R -->|0| S
R -->|Positive interval elapsed| S
R -->|Positive interval not elapsed| K
S --> D{Delivery succeeds?}
D -->|Yes| T[Persist lastNotifiedAt]
D -->|No| F[Leave notification clock unchanged]
T --> N[Next evaluation]
F --> N
K --> N
N --> O{Alert returns to OK?}
O -->|Yes| V[Send resolve notification]
O -->|No| E
Reviews (4): Last reviewed commit: "fix: missing field in test" | Re-trigger Greptile
Signed-off-by: Niladri Adhikary <niladrix719@gmail.com>
Signed-off-by: Niladri Adhikary <niladrix719@gmail.com>
Signed-off-by: Niladri Adhikary <niladrix719@gmail.com>
Summary
Adds a renotifyIntervalMinutes alert setting and changes the default so alerts stop re-notifying on every evaluation while firing, unset notifies once on the OK→ALERT transition, 0 restores the old every-evaluation behavior, and N re-notifies every N minutes.
fixes #2464
Screenshots or video
How to test on Vercel preview
The "Re-notify every" field lives in the saved-search alert modal (
DBSearchPage.tsx) and the dashboard tile alert editor (ChartEditorControls.tsx), both gated behind!IS_LOCAL_MODE. The Vercel preview build runs in LOCAL_MODE