From 3afcc5215e85aee3a13c10a97550936bace6dc04 Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Tue, 20 Jun 2023 05:48:48 -0400 Subject: [PATCH] [v10.0.x] Docs: Add callout for variables behavior with classic conditions (#70368) Docs: Add callout for variables behavior with classic conditions (#67253) * Add doc on classic condition behaviour with labels * Update docs/sources/alerting/fundamentals/annotation-label/variables-label-annotation.md Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com> --------- Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com> (cherry picked from commit 69402f859b314dfdf37b6535316f7a86b6eac1e3) Co-authored-by: Alfredo <109958902+alfredo-d@users.noreply.github.com> --- .../annotation-label/variables-label-annotation.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/sources/alerting/fundamentals/annotation-label/variables-label-annotation.md b/docs/sources/alerting/fundamentals/annotation-label/variables-label-annotation.md index 9a5496529df..67ef6730389 100644 --- a/docs/sources/alerting/fundamentals/annotation-label/variables-label-annotation.md +++ b/docs/sources/alerting/fundamentals/annotation-label/variables-label-annotation.md @@ -122,6 +122,14 @@ If the rule uses Classic Conditions instead of Threshold, Reduce and Math expres The first condition is {{ $values.B0 }}, and the second condition is {{ $values.B1 }} ``` +With classic conditions, labels from the query are not available in `$labels` variable, because single alert instance are generated. Instead, you can retrieve the labels from the `$values` variable. + +``` +{{ range $k, $v := $values }} +The value is {{ $v }} and the labels are {{ $v.Labels }} +{{ end }} +``` + ## Functions The following functions are also available when expanding labels and annotations: