-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Add parse alerting for rules files before loading WAL #16601
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
Conversation
4ef8f8a
to
30f913e
Compare
Builds over prometheus#16462 Addresses comments, adds invalid rules file Co-authored-by: marcodebba <marcodebonis74@gmail.com> Co-authored-by: subhramit <subhramit.bb@live.in> Signed-off-by: subhramit <subhramit.bb@live.in>
30f913e
to
fbf01ef
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.
Thanks for carrying this forward, looks good to me 👍
Hi team, would anything else be needed here? Or could this be merged? |
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.
Pull Request Overview
This PR adds functionality to pre-parse rules files before the WAL is loaded, ensuring that invalid rule files are caught early. Key changes include:
- Adding a new function (ParseFiles) to parse rule files from glob patterns.
- Introducing tests in manager_test.go to validate both successful and failing parsing scenarios.
- Updating the main application logic (in cmd/prometheus/main.go) to invoke the new parsing step.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
rules/manager_test.go | Added tests for validating both valid and invalid rules files. |
rules/manager.go | Introduced the ParseFiles function to pre-parse rule files. |
rules/fixtures/invalid_rules.yaml | Added a fixture for an invalid rule file to test error handling. |
cmd/prometheus/main.go | Updated main to call ParseFiles to verify rule files before loading. |
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, thanks!
Fixes #11486
Add functionality (and corresponding test) to parse rules files before loading the WAL.
rules/fixtures
to test the error case of the parse function.This eliminates infinite systemd crash-restart loops due to invalid rules files that caused disk exhaustion and multi-day outages as mentioned in the issue.
Refs. #7322, #7399