-
Notifications
You must be signed in to change notification settings - Fork 11.7k
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
Provisioning/Alerting: Environment variable substitution not working for annotations #84250
Comments
Hi @JohnnyQQQQ, is this open for contribution? I'd like to open a PR for the same. |
Yes it is. You can see how to implement it by taking a look at how we do it for labels here grafana/pkg/services/provisioning/alerting/rules_types.go Lines 122 to 123 in bd2b248
So instead of doing Make sure to add some tests. |
…rt rule. see: grafana#84250 Signed-off-by: Syed Nihal <syed.nihal@nokia.com>
After a bit of further research, I now remember why we removed it. Please check out #54850 We might want to find a way to support both. |
Sure, I will explore a bit of template expansion and make changes to support both kinds of expansions. |
@JohnnyQQQQ , after looking into the codebase of the environment variable expander, I see it is possible to prevent the expansion and preserve the original formatting by prefixing the expression with an additional For example, I have validated these scenarios with from the binary build from the above commit (that uses Please do let me know your thoughts on this. Snippet of alert rule used for local testing:
Test Notification Received on Slack: |
I think the main problem with this is that it would be a breaking change, as As I'm leaving the alerting team this week I will ping the right person to make a decision here and follow up. |
What happened?
Hi,
we are working on enhancing our alerting right now and for this we want to use the environment variable substitution a bit more but have discovered that it is not working as expected.
We use currently env substitution for the labels in our alert files which is working.
But it looks like it is, for unknown reasons, not working when we try it in annotations which is unexpected.
We deploy our Grafana instance with Helm and use the provisioning path for setting up our alerts like this:
Below you can see that we have tested a few combinations for the annotations but in the screenshot you see its not rendered.
But for the labels its working as expected.
What did you expect to happen?
Environments variables are substituted in annotations in the same way as in labels.
Did this work before?
no
How do we reproduce it?
Alert file
Results in rendered label but not rendered in annotations
Is the bug inside a dashboard panel?
No response
Environment (with versions)?
Grafana: v10.3.3 (2527612)
OS:
Browser:
Grafana platform?
Kubernetes
Datasource(s)?
No response
The text was updated successfully, but these errors were encountered: