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
Alerting: Support values in notification templates #56457
Alerting: Support values in notification templates #56457
Conversation
Drone build failed: https://drone.grafana.net/grafana/grafana-enterprise/36490 |
Drone build failed: https://drone.grafana.net/grafana/grafana-enterprise/36595 |
Drone build failed: https://drone.grafana.net/grafana/grafana-enterprise/36599 |
75f3cbe
to
5ab45f2
Compare
30259f2
to
05931fa
Compare
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.
LGTM!
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 please update the docs in UI
here
grafana/public/app/features/alerting/unified/components/receivers/TemplateData.ts
Lines 114 to 118 in 4c4b758
{ | |
name: 'ValueString', | |
type: 'string', | |
notes: 'String that contains the labels and value of each reduced expression in the alert.', | |
}, |
This commit adds a much requested feature to support values of reduce, math and classic conditions in notification templates.
05931fa
to
6401bb4
Compare
Drone build failed: https://drone.grafana.net/grafana/grafana-enterprise/36913 |
Awesome, thank you; this'll be hugely helpful 🏆 It looks to me like this doesn't risk breaking any existing alerting rule / templates -- the only difference it would make is that anyone who's currently dumping the entire ValueString into a notification will get a differently formatted result, right? The main question I have is about updating docs & providing examples there, plus (ideally) how we should update the UI to help users 1) learn this is now possible and 2) help them do it correctly |
All users who are using However, all users who are using the default template, or even just I will work with @brendamuir to also document this in the Whats New page. I would like to get it into 9.2.0 if there will be a beta2, otherwise I think we should wait for 9.3.0. |
What this PR does / why we need it:
We have received a lot of feedback regarding the
ValueString
in alert notifications. Perhaps one of the most frequent complaints about ValueString is that it is difficult to read because it contains a lot of information, and the information is shown as a JSON-like string. Users have often asked how it can be templated and the answer is that it can't.Until now users have been able to add custom annotations to their alert rules which contains values via the $values variable added in previous versions of Grafana. However, these custom annotations must be added for each of the user's alert rule, instead of once in a template that all of their alerts can be notified via.
This commit adds then the much requested feature to support values in notification templates. Users can then create a single template that prints the annotations, labels and values of their alerts in a format of their choice!
Here is an example of the default template with an instant vector:
Here is an example of the default template with a reduce expression:
Here is an example of the default template with a reduce and math expression:
Last is an example of the default template with a non-reduced time series:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer: