[alerter]bugfix: preserve group alert recovery events#4168
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes two alert-group lifecycle edge cases in the alerter pipeline: ensuring recovery (resolved) events are not suppressed by the firing repeat-interval throttle, and ensuring persisted group status reflects the aggregate state of all known member alerts (not just the current push window).
Changes:
- Bypass the group repeat-interval throttle when the group payload includes any resolved member alerts.
- Recompute a group’s persisted status in the DB store layer from all member alert statuses (by fingerprint), and add regression tests for both reducer and store paths.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| hertzbeat-alerter/src/main/java/org/apache/hertzbeat/alert/reduce/AlarmGroupReduce.java | Adjusts repeat-throttle behavior so mixed firing groups with resolved members are still dispatched. |
| hertzbeat-alerter/src/main/java/org/apache/hertzbeat/alert/notice/impl/DbAlertStoreHandlerImpl.java | Recomputes persisted group status from stored member alerts before saving. |
| hertzbeat-alerter/src/test/java/org/apache/hertzbeat/alert/reduce/AlarmGroupReduceTest.java | Adds a regression test for “resolved bypasses repeat throttle”. |
| hertzbeat-alerter/src/test/java/org/apache/hertzbeat/alert/notice/impl/DbAlertStoreHandlerImplTest.java | Adds a regression test ensuring group status stays firing when other members still fire. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I rebased the branch onto the current master and rechecked the three earlier review points on the latest head: missing group rules now use the default repeat interval, resolved groups reload the full persisted member list, and firing groups skip the extra DB lookup. The focused AlarmGroupReduceTest and DbAlertStoreHandlerImplTest suites pass locally (11 tests, 0 failures/errors), with checkstyle passing across the reactor. The old threads are now outdated and resolved; this is ready for maintainer review. |
What's changed
Close #4160.
This fixes two group alert lifecycle cases:
Regression tests cover both the in-memory group reducer path and the database store path.
Verification
JAVA_HOME=$(/usr/libexec/java_home -v 25 2>/dev/null || /usr/libexec/java_home) ./mvnw -pl hertzbeat-alerter -am testgit diff --check