prometheus/prometheus

promtool: Allow inexact matches in exp_alerts

Ouverte

#7 370 ouverte le 9 juin 2020

 (8 commentaires) (16 réactions) (1 personne assignée)Go (10 408 forks)batch import
component/promtoolhelp wantedkind/enhancementpriority/Pmaybe

Métriques du dépôt

Stars
 (64 042 étoiles)
Métriques de merge PR
 (Merge moyen 11j 5h) (118 PRs mergées en 30 j)

Description

Proposal

Use case. Why is this important? Currently, when building a rule test, one needs the exp_alerts to be exact matches of the alert that would fire, with all labels and annotations. Since these can be fairly rich in real-world usage, I propose that matching can be "inexact". Rather than all labels and annotations being exact matches, only those actually present in the exp_labels and exp_annotations must match. I frequently come across organisations where entire runbooks are written in annotations, and duplicating those into each rule adds a lot of friction to test adoption. Fixing a typo in the runbook breaking unit tests, for example.

This could be made opt-in with a matching_mode or such, if there is a frequent desire to match all the things.

Alternatively, or perhap as a complement, being able to check for presence but ignoring content. This could facilitate something like a test that validates that all alerting rules have a runbook, for example.

Guide contributeur