grafana/docs/sources/alerting/fundamentals/annotation-label/variables-label-annotation.md
JitaC 6397b34f8b
Docs: Move labels and annotations topic to alerting fundamentals section (#49283)
* Moved annotation and labels topic to fundamentals and added label matching to the same section

* Cosmetic updates to "How label matching works topic"

* Few more changes to annotations and label section. Also added stem sentence to silences topics.

* Fixed one more broken relref.

* Update docs/sources/alerting/fundamentals/_index.md

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
2022-05-19 19:17:57 -04:00

2.3 KiB

+++ title = "Template variables for alerting rule labels and annotations" description = "Learn about labels and label matchers in alerting" keywords = ["grafana", "alerting", "guide", "fundamentals"] weight = 117 +++

Template variables for alerting rule labels and annotations

The following template variables are available when expanding annotations and labels.

Name Description
$labels The labels from the query or condition. For example, {{ $labels.instance }} and {{ $labels.job }}. This is unavailable when the rule uses a [classic condition]({{< relref "../../alerting-rules/create-grafana-managed-rule/#single-and-multi-dimensional-rule" >}}).
$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. If the rule uses classic conditions, then a combination of the refID and position of the condition is used. For example, {{ $values.A0.Value }} or {{ $values.A1.Value }}
$value The value string of the alert instance. For example, [ var='A' labels={instance=foo} value=10 ].