From 1bcc80daa73371eea752e4acb54bb2f60ed16271 Mon Sep 17 00:00:00 2001 From: "grafana-delivery-bot[bot]" <132647405+grafana-delivery-bot[bot]@users.noreply.github.com> Date: Mon, 10 Mar 2025 11:54:15 +0100 Subject: [PATCH] [release-11.5.3] Alerting docs: dynamic label changes (#101866) Alerting docs: dynamic label changes (#101781) (cherry picked from commit 23ccd2be951c218cc3217419bffc7543c73996aa) Co-authored-by: Pepe Cano <825430+ppcano@users.noreply.github.com> --- .../alerting/alerting-rules/templates/_index.md | 4 +--- .../alerting/alerting-rules/templates/examples.md | 4 +--- docs/sources/shared/alerts/note-dynamic-labels.md | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 docs/sources/shared/alerts/note-dynamic-labels.md diff --git a/docs/sources/alerting/alerting-rules/templates/_index.md b/docs/sources/alerting/alerting-rules/templates/_index.md index cf211fed7b6..f6da85e1977 100644 --- a/docs/sources/alerting/alerting-rules/templates/_index.md +++ b/docs/sources/alerting/alerting-rules/templates/_index.md @@ -190,9 +190,7 @@ low In this example, the value of the `severity` label is determined by the query value, and the possible options are `critical`, `high`, `medium`, or `low`. You can then use the `severity` label to change their notifications—for instance, sending `critical` alerts immediately or routing `low` alerts to a specific team for further review. -{{% admonition type="note" %}} -You should avoid displaying query values in labels, as this may create numerous unique alert instances—one for each distinct label value. Instead, use annotations for query values. -{{% /admonition %}} +{{< docs/shared lookup="alerts/note-dynamic-labels.md" source="grafana" version="" >}} ### How to template a label diff --git a/docs/sources/alerting/alerting-rules/templates/examples.md b/docs/sources/alerting/alerting-rules/templates/examples.md index c8c6f9dbb40..e9ee1a8015b 100644 --- a/docs/sources/alerting/alerting-rules/templates/examples.md +++ b/docs/sources/alerting/alerting-rules/templates/examples.md @@ -209,9 +209,7 @@ In this example, the `severity` label is determined by the query value: You can then use the `severity` label to control how alerts are handled. For instance, you could send `critical` alerts immediately, while routing `low` severity alerts to a team for further investigation. -{{% admonition type="note" %}} -You should avoid displaying query values in labels, as this may create many alert instances—one for each distinct label value. Instead, use annotations to convey query values. -{{% /admonition %}} +{{< docs/shared lookup="alerts/note-dynamic-labels.md" source="grafana" version="" >}} ### Based on query label diff --git a/docs/sources/shared/alerts/note-dynamic-labels.md b/docs/sources/shared/alerts/note-dynamic-labels.md new file mode 100644 index 00000000000..d657c4249a6 --- /dev/null +++ b/docs/sources/shared/alerts/note-dynamic-labels.md @@ -0,0 +1,14 @@ +--- +labels: + products: + - oss +title: 'Note Dynamic labels' +--- + +{{% admonition type="note" %}} + +An alert instance is uniquely identified by its set of labels. + +- Avoid displaying query values in labels, as this can create numerous alert instances—one for each distinct label set. Instead, use annotations for query values. +- If a templated label's value changes, it maps to a different alert instance, and the previous instance transitions to the `No data` state when its label value is no longer present. + {{% /admonition %}}