![]() You cannot use $labels to print labels from the query if you are using classic conditions, and must use $values instead. Print all labels from a classic condition To print all labels, comma separated, print the $labels variable: For more information on how to write text/template refer to the text/template documentation. You can use these examples verbatim, or adapt them as necessary for your use case. Rather than write a complete tutorial on text/template, the following examples attempt to show the most common use-cases we have seen for templates. You should try to avoid doing expensive computations in your templates as much as possible. ![]() For example, if your alert rule has a templated summary annotation, and the alert rule has 10 firing alerts, then the template will be executed 10 times, once for each alert. This means you cannot share templates between labels and annotations, and instead you will need to copy templates wherever you want to use them.Įach template is evaluated whenever the alert rule is evaluated, and is evaluated for every alert separately. Regardless of whether you are templating a label or an annotation, you should write each template inline inside the label or annotation that you are templating. For example, you might want to set the severity label for an alert based on the value of the query, or use the instance label from the query in a summary annotation so you know which server is experiencing high CPU usage.Īll templates should be written in text/template. You can use templates to include data from queries and expressions in labels and annotations. ![]() Grafana Cloud Templating labels and annotations ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |