prometheus / prometheus/prometheus

promtool: Allow inexact matches in exp_alerts

Open
#7,370 8 comments 16 reactions 1 assignee View on GitHub

@Aurifi is already working on this.

Since Jun 20, 2024.

component/promtool help wanted kind/enhancement priority/Pmaybe
Dominant language
Go
Stars
66.1k
Forks
10.8k
Avg merge
2d 1h
Merged PRs (30d)
131

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.