-
Notifications
You must be signed in to change notification settings - Fork 2.2k
"rule" Add CheckRulesFiles method to replace rulefmt.ParseFile in prometheus #6658
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
base: main
Are you sure you want to change the base?
Conversation
pkg/rules/rules.go
Outdated
|
|
||
| import ( | ||
| "context" | ||
| "github.com/thanos-io/thanos/pkg/errutil" |
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.
can you group this with the other thanos-io imports?
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.
do you mean
import (
"github.com/thanos-io/thanos/pkg/errutil"
)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.
Ah, no i meant to put it on line 20 roughly where rules/rulespb and tracing are imported
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.
of course
| return srv.ctx | ||
| } | ||
|
|
||
| func CheckRulesFiles(filePaths []string) error { |
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.
I dont see that this is called anywhere; why is it needed?
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.
just like the issue I mentioned above, we need a method to replace rulefmt.ParseFile in prometheus since thanos change the alert rule file and and rulefmt.ParseFile cannot chech the changed file.
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.
Is there any way we could use it in the code-base itself? I'm afraid that this logic will get stale.
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.
no, the key func is ValidateAndCount(), which is used by thanos CLI tool,too.
Signed-off-by: Cruvie <>
Changes
Add CheckRulesFiles method to replace rulefmt.ParseFile in prometheus
#6641
Verification
run TestCheckRulesFiles to text the method