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
base: main
Are you sure you want to change the base?
Conversation
Docs Build 📝Thank you for contribution!✨ The docs for this PR have been published here: You can compare to the docs for the The docsite for this PR is also available for download as an artifact from this run: File changes: Click to see the diff comparison.NOTE: only file modifications are shown here. New and deleted files are excluded. diff --git a/home/runner/work/ansible/ansible/docsbuild/base/prometheus_role.html b/home/runner/work/ansible/ansible/docsbuild/head/prometheus_role.html
index db53335..d2d72e9 100644
--- a/home/runner/work/ansible/ansible/docsbuild/base/prometheus_role.html
+++ b/home/runner/work/ansible/ansible/docsbuild/head/prometheus_role.html
@@ -199,8 +199,8 @@ To check whether it is installed, run <code class="code docutils literal notrans
<div class="ansibleOptionAnchor" id="parameter-main--prometheus_alert_rules"></div><p class="ansible-option-title" id="ansible-collections-prometheus-prometheus-prometheus-role-parameter-main-prometheus-alert-rules"><strong>prometheus_alert_rules</strong></p>
<a class="ansibleOptionLink" href="#parameter-main--prometheus_alert_rules" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">list</span> / <span class="ansible-option-elements">elements=dictionary</span></p>
</div></td>
-<td><div class="ansible-option-cell"><p>Full list of alerting rules which will be copied to <code class="docutils literal notranslate"><span class="pre">{{</span> <span class="pre">prometheus_config_dir</span> <span class="pre">}}/rules/ansible_managed.rules</span></code>.</p>
-<p>Alerting rules can be also provided by other files located in <code class="docutils literal notranslate"><span class="pre">{{</span> <span class="pre">prometheus_config_dir</span> <span class="pre">}}/rules/</span></code> which have <code class="docutils literal notranslate"><span class="pre">*.rules</span></code> extension</p>
+<td><div class="ansible-option-cell"><p>Full list of alerting rules which will be copied to <code class="docutils literal notranslate"><span class="pre">{{</span> <span class="pre">prometheus_config_dir</span> <span class="pre">}}/rules/ansible_managed.yml</span></code>.</p>
+<p>Alerting rules can be also provided by other files located in <code class="docutils literal notranslate"><span class="pre">{{</span> <span class="pre">prometheus_config_dir</span> <span class="pre">}}/rules/</span></code> which have a <code class="docutils literal notranslate"><span class="pre">*.yml</span></code> or <code class="docutils literal notranslate"><span class="pre">*.yaml</span></code> extension</p>
<p>Please see default values in role defaults/main.yml</p>
</div></td>
</tr>
@@ -209,8 +209,8 @@ To check whether it is installed, run <code class="code docutils literal notrans
<a class="ansibleOptionLink" href="#parameter-main--prometheus_alert_rules_files" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">list</span> / <span class="ansible-option-elements">elements=string</span></p>
</div></td>
<td><div class="ansible-option-cell"><p>List of folders where ansible will look for files containing alerting rules which will be copied to <code class="docutils literal notranslate"><span class="pre">{{</span> <span class="pre">prometheus_config_dir</span> <span class="pre">}}/rules/</span></code>.</p>
-<p>Files must have <code class="docutils literal notranslate"><span class="pre">*.rules</span></code> extension</p>
-<p class="ansible-option-line"><strong class="ansible-option-default-bold">Default:</strong> <code class="ansible-option-default docutils literal notranslate"><span class="pre">["prometheus/rules/*.rules"]</span></code></p>
+<p>Files must have a <code class="docutils literal notranslate"><span class="pre">*.yml</span></code> or <code class="docutils literal notranslate"><span class="pre">*.yaml</span></code> extension</p>
+<p class="ansible-option-line"><strong class="ansible-option-default-bold">Default:</strong> <code class="ansible-option-default docutils literal notranslate"><span class="pre">["prometheus/rules/*.yml",</span> <span class="pre">"prometheus/rules/*.yaml"]</span></code></p>
</div></td>
</tr>
<tr class="row-even"><td><div class="ansible-option-cell">
|
Signed-off-by: dpavle <dencic.pavle@gmail.com>
Co-authored-by: Ben Kochie <superq@gmail.com> Signed-off-by: Pavle <17710777+dpavle@users.noreply.github.com>
Please also update the updated docs. |
Signed-off-by: dpavle <17710777+dpavle@users.noreply.github.com>
There are some other references to |
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.
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 As for the warning in the preflight, sure, that could be done. I'm just not sure how exactly, do we fail if any And yes, |
We probably want to keep the |
That's why I suggested a error in the preflight, but we could also make that a warning for now and then drop |
Signed-off-by: dpavle <17710777+dpavle@users.noreply.github.com>
…les extension Signed-off-by: dpavle <17710777+dpavle@users.noreply.github.com>
Signed-off-by: dpavle <17710777+dpavle@users.noreply.github.com>
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. |
No description provided.