prometheus / prometheus/alertmanager

[feature request] allow matched values from source_match_re in target_match

Open
#2,395 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component/inhibition stale
Dominant language
Go
Stars
8.6k
Forks
2.5k
Avg merge
2d 6h
Merged PRs (30d)
61

Description

Feature Request
It would be awesome if the target_match and/or target_match_re from inhibit_rules was able to use matched values from source_match_re - this would allow you to inhibit a range of different rules based on some values from the source_match_re.

Looking at the code and docs I couldn't see that this was possible, and I did a quick search of the GitHub issues and couldn't find anything similar.

Example Config

inhibit_rules:
  - source_match_re:
      alertname: 'esx-host-down'
      instance: 'syd-esx-(\d+).mycompany.com'
    target_match:
      alertname: 'vm-not-responding'
      esx_host: 'syd-esx-$1.mycompany.com'

Result
All alerts for vm-not-responding for VMs that have esx_host=syd-esx-01.mycompany.com will be suppressed.

Note
Not sure how this would work in terms of multiple matched values in different keys under source_match_re (do you just use index $1 $2 $3 etc, or do you somehow also include the key from source_match_re? Like $instance.1 (or similar)

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Start by tracing how inhibit_rules, source_match_re, target_match, and target_match_re are represented and evaluated. Resolve how captured values and multiple source regular expressions should be referenced, then verify that the example configuration suppresses only matching alerts and that the behavior is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
observability-sre
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.