enhancement(prometheus): support prometheus2 .yml rule file format
Docs Build 📝
Thank you for contribution!✨
This PR has been merged and the docs are now incorporated into main:
https://prometheus-community.github.io/ansible/branch/main
Please also update the updated docs.
There are some other references to .rules files in the role. Maybe worth cleaning up more.
If we want to support both
.rulesand.ymlas proposed by this PR then both should be listed in the docs and argument specs.But if we want to drop
.rulesthen that should be done clearly with a warning in the preflight.Also
.yamlshould be supported since both.ymland.yamlare valid yaml file extensions.
I'm for removing the old .rules format. It's essentially been deprecated since 2017 and it doesn't work in any recent version of Prometheus as far as I'm aware.
As for the warning in the preflight, sure, that could be done. I'm just not sure how exactly, do we fail if any .rules files are found in /rules?
And yes, .yaml should also be supported.
We probably want to keep the *.rules handling, at least from a configuration loading perspective, around in order to maintain backwards compatibility. Otherwise existing deployments that are pushing yaml to files named .rules will break.
We probably want to keep the
*.ruleshandling, at least from a configuration loading perspective, around in order to maintain backwards compatibility. Otherwise existing deployments that are pushing yaml to files named.ruleswill break.
That's why I suggested a error in the preflight, but we could also make that a warning for now and then drop *.rules support in the future.
Or we could handle it automatically by adding a task that renames .rules to .yml
We probably want to keep the
*.ruleshandling, at least from a configuration loading perspective, around in order to maintain backwards compatibility. Otherwise existing deployments that are pushing yaml to files named.ruleswill break.That's why I suggested a error in the preflight, but we could also make that a warning for now and then drop
*.rulessupport in the future. Or we could handle it automatically by adding a task that renames.rulesto.yml
A warning works. If there are any YAML formatted files with the .rules extension there will be a warning message in the preflight and the rule validation will pass normally. On the other hand, if there are any rules in the old .rules format, the warning message will show in the preflight and promtool check validation will catch them and fail in a later step.
@dpavle any chance you could refactor this so that we can get it merged?
@dpavle any chance you could refactor this so that we can get it merged?
sure, I'll take a look at it
@SuperQ any outstanding issues or are we good to go?