Docs: adds docs on excluding labels (#78806)

* Docs: adds docs on excluding labels

* run prettier

* Update docs/sources/alerting/fundamentals/annotation-label/labels-and-label-matchers.md

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>

* adds table for display

* ran prettier

---------

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
This commit is contained in:
brendamuir 2023-11-30 10:26:22 +01:00 committed by GitHub
parent 12b624313c
commit 1b2a621533
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,3 +50,15 @@ then:
- A label matcher defined as `id=~[0-9]+` matches this alert rule.
- A label matcher defined as `baz!~[0-9]+` matches this alert rule.
- Two label matchers defined as `foo=bar` and `id=~[0-9]+` match this alert rule.
## Exclude labels
You can also write label matchers to exclude labels.
Here is an example that shows how to exclude the label `Team`. You can choose between any of the values below to exclude labels.
| Label | Operator | Value |
| ------ | -------- | ----- |
| `team` | `=` | `""` |
| `team` | `!~` | `.+` |
| `team` | `=~` | `^$` |