mirror of
https://github.com/grafana/grafana.git
synced 2025-02-14 09:33:34 -06:00
Documentation: clarify label matching (#55650)
* Documentation: clarify label matching Behaviour in case of multiple matchers is not documented, but my experiments show they are reduced using logical AND. Please validate the updated description. * Accept wording suggestion Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com> * Accept suggestion for docs/sources/alerting/fundamentals/annotation-label/labels-and-label-matchers.md Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com> * Improve wording according to review suggestions Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
This commit is contained in:
parent
51028b1b2e
commit
efef672d19
@ -30,15 +30,18 @@ A label matchers consists of 3 distinct parts, the **label**, the **value** and
|
||||
| `=~` | Select labels that regex-match the value. |
|
||||
| `!~` | Select labels that do not regex-match the value. |
|
||||
|
||||
## Example of a label matcher
|
||||
If you are using multiple label matchers, they are combined using the AND logical operator. This means that all matchers must match in order to link a rule to a policy.
|
||||
|
||||
Imagine we've defined the following set of labels for our alert.
|
||||
## Example scenario
|
||||
|
||||
If you define the following set of labels for your alert:
|
||||
|
||||
`{ foo=bar, baz=qux, id=12 }`
|
||||
|
||||
In this situation,
|
||||
then:
|
||||
|
||||
- A label matcher defined as `foo=bar` will match this alert rule.
|
||||
- A label matcher defined as `foo!=bar` will _not_ match this alert rule.
|
||||
- A label matcher defined as `id=~[0-9]+` will match this alert rule.
|
||||
- A label matcher defined as `baz!~[0-9]+` will match this alert rule.
|
||||
- A label matcher defined as `foo=bar` matches this alert rule.
|
||||
- A label matcher defined as `foo!=bar` does _not_ match this alert rule.
|
||||
- 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.
|
||||
|
Loading…
Reference in New Issue
Block a user