Skip to content
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

enhancement(prometheus): support prometheus2 .yml rule file format #333

Merged
merged 8 commits into from
Oct 31, 2024

Conversation

dpavle
Copy link
Contributor

@dpavle dpavle commented Apr 15, 2024

No description provided.

@github-actions github-actions bot added enhancement New feature or request roles/prometheus labels Apr 15, 2024
Copy link
Contributor

github-actions bot commented Apr 15, 2024

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

@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 15, 2024
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 15, 2024
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 15, 2024
@SuperQ
Copy link
Contributor

SuperQ commented Apr 15, 2024

Please also update the updated docs.

@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 15, 2024
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 15, 2024
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 15, 2024
@dpavle dpavle requested a review from SuperQ April 16, 2024 13:22
@SuperQ SuperQ requested a review from gardar April 16, 2024 19:59
@SuperQ
Copy link
Contributor

SuperQ commented Apr 16, 2024

There are some other references to .rules files in the role. Maybe worth cleaning up more.

Copy link
Member

@gardar gardar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to support both .rules and .yml as proposed by this PR then both should be listed in the docs and argument specs.

But if we want to drop .rules then that should be done clearly with a warning in the preflight.

Also .yaml should be supported since both.yml and .yaml are valid yaml file extensions.

@dpavle
Copy link
Contributor Author

dpavle commented Apr 17, 2024

If we want to support both .rules and .yml as proposed by this PR then both should be listed in the docs and argument specs.

But if we want to drop .rules then that should be done clearly with a warning in the preflight.

Also .yaml should be supported since both.yml and .yaml are 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.

@gardar
Copy link
Member

gardar commented Apr 17, 2024

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.

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

@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 17, 2024
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 18, 2024
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 18, 2024
@dpavle
Copy link
Contributor Author

dpavle commented Apr 18, 2024

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.

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

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 dpavle requested a review from gardar April 18, 2024 11:01
Copy link
Member

@gardar gardar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gardar gardar requested a review from SuperQ June 6, 2024 17:20
@gardar
Copy link
Member

gardar commented Oct 30, 2024

@dpavle any chance you could refactor this so that we can get it merged?

@dpavle
Copy link
Contributor Author

dpavle commented Oct 30, 2024

@dpavle any chance you could refactor this so that we can get it merged?

sure, I'll take a look at it

@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Oct 30, 2024
@gardar
Copy link
Member

gardar commented Oct 31, 2024

@SuperQ any outstanding issues or are we good to go?

Copy link
Contributor

@SuperQ SuperQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, LGTM

@gardar gardar merged commit e4384eb into prometheus-community:main Oct 31, 2024
59 checks passed
gardar added a commit to gardar/prometheus-demo-site that referenced this pull request Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request roles/prometheus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants