tomsun28 opened a new pull request, #4450:
URL: https://github.com/apache/hertzbeat/pull/4450

   ## What's changed?
   
   Close #4446
   
   Alert sources such as Prometheus keep reposting the same resolved alert on 
every resend interval until they forget it. In `AlarmGroupReduce`, once a 
recovery notification was emitted the resolved member was evicted from the 
group fingerprint cache, so each repost looked like a brand-new alert: it was 
re-added, `shouldSendGroupImmediately` saw an all-resolved cache, and the same 
recovery notification was sent again. This produced the repeated WeCom recovery 
messages reported in the issue.
   
   Fix: `GroupAlertCache` now remembers fingerprints whose resolved state was 
already emitted.
   
   - A reposted resolved alert with no active firing member is dropped instead 
of re-entering the cache.
   - A resolved alert never seen firing (e.g. after a restart) is still emitted 
once, then its reposts are deduplicated.
   - A new firing alert with the same fingerprint clears the resolved marker 
and starts a fresh incident lifecycle, so it can fire and resolve again 
normally.
   - Failed sends still retain the pending resolved member for retry; the 
marker is recorded on successful emission (or at ingress for first-seen 
resolutions) so no recovery is lost.
   
   ## Checklist
   
   - [x]  I have read the [Contributing 
Guide](https://hertzbeat.apache.org/docs/community/code_style_and_quality_guide)
   - [x]  I have written the necessary doc or comment.
   - [x]  I have added the necessary unit tests and all cases have passed.
   
   `AlarmGroupReduceTest`: 17 tests pass, including two new regressions — 
reposted resolved alerts no longer trigger extra notifications, and a 
first-seen resolved alert is still emitted exactly once.
   
   ## Add or update API
   
   - [ ] I have added the necessary [e2e 
tests](https://github.com/apache/hertzbeat/tree/master/e2e) and all cases have 
passed.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to