Expand the value string in annotations and labels of alerts (#37051)

This commit makes it possible to use the value string in
annotations and labels for alerts with "{{ $value }}"
This commit is contained in:
George Robinson
2021-07-22 15:20:44 +01:00
committed by GitHub
parent ad1f792b8b
commit 2f4c893cf3
3 changed files with 77 additions and 8 deletions
@@ -109,8 +109,9 @@ The following template variables are available when expanding annotations and la
| Name | Description |
| ------- | --------------- |
| $labels | Labels contains the labels from the query or condition. For example, `{{ $labels.instance }}` and `{{ $labels.job }}`. |
| $values | Values contains the values of all reduce and math expressions that were evaluated for this alert rule. For example, `{{ $values.A }}`, `{{ $values.A.Labels }}` and `{{ $values.A.Value }}` where `A` is the `refID` of the expression. |
| $labels | The labels from the query or condition. For example, `{{ $labels.instance }}` and `{{ $labels.job }}`. |
| $values | The values of all reduce and math expressions that were evaluated for this alert rule. For example, `{{ $values.A }}`, `{{ $values.A.Labels }}` and `{{ $values.A.Value }}` where `A` is the `refID` of the expression. |
| $value | The value string of the alert instance. For example, `[ var='A' labels={instance=foo} value=10 ]`. |
## Preview alerts