-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: correlation rule threshold counts already resolved alerts #5128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: correlation rule threshold counts already resolved alerts #5128
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git βοΈ 1 Skipped Deployment
|
π¨ BugBot couldn't runBugBot is experiencing high demand right now. Try again in a few minutes by commenting "bugbot run" (requestId: serverGenReqId_aee548f4-b3d0-4686-be70-42dc65d7690b). |
863ab7b to
f020533
Compare
π¨ BugBot couldn't runBugBot is experiencing high demand right now. Try again in a few minutes by commenting "bugbot run" (requestId: serverGenReqId_d340d18c-ff81-495e-8bb0-8bf0125e33a0). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, apart from minor style issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
Implements a new unresolvedCounter system to fix correlation rule thresholds counting resolved alerts, ensuring incidents only trigger based on currently active alerts.
- Added
unresolvedCounterfield toAlertDtomodel inkeep/api/models/alert.pyto track unresolved alerts separately from totalfiringCounter - Modified
keep/rulesengine/rulesengine.pyto useunresolvedCounterinstead offiringCounterwhen evaluating incident thresholds - Added
calculated_unresolved_counterhelper inkeep/api/utils/enrichment_helpers.pythat resets to 0 when alerts are resolved - Added comprehensive test coverage in
tests/test_counting_integration.pyandtests/test_rules_engine.pyvalidating threshold behavior with grouped and same-fingerprint alerts
8 files reviewed, 7 comments
Edit PR Review Bot Settings | Greptile
This commit introduces a new test to verify incident visibility and alert grouping behavior when thresholds are applied. It ensures incidents start automatically based on alert thresholds, validating grouping functionality and enrichment logic.
Introduce `unresolvedCounter` to track the number of unresolved alerts before resolution. Updated alert processing logic, added helper functions, and extended test coverage to ensure the counter increments/decrements as expected in various scenarios.
Updated a docstring to clarify the calculation of the unresolved counter in `enrichment_helpers.py`. Also adjusted import formatting in `process_event_task.py` for better readability.
Corrected the unresolved counter calculation and adjusted test cases to ensure accurate validation of resolved alert statuses. Updated comments and assertions to align with the clarified counter behavior.
f20d388 to
a83758c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Closes #5115
π Description
β Checks
βΉ Additional Information