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>
This commit is contained in:
Alfredo 2023-05-03 16:43:11 +08:00 committed by GitHub
parent b10d415569
commit 69402f859b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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: