prometheus / prometheus/alertmanager

feature request - templated route matcher expressions

Open
#4,032 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discuss-in-meeting kind/enhancement
Dominant language
Go
Stars
8.6k
Forks
2.5k
Avg merge
2d 6h
Merged PRs (30d)
61

Description

Hi,

I see I can define matcher rules like this

route:
  routes:
    - matchers:
        - alertname =~ ".*foo.*"
      receiver: my_receiver

what I'd want would be the possibility to leverage the alerts' labels, and the available functions, to dynamically construct that regex with something like

route:
  routes:
    - matchers:
        - alertname =~ ".*{{ .CommonLabels.some_label  }}.*"
      receiver: my_receiver

and even

route:
  routes:
    - matchers:
        - alertname =~ ".*{{ .CommonLabels.some_label | reReplaceAll 'foo' 'bar'  }}.*"
      receiver: my_receiver

That would let admins define small but dynamic set of rules, that would let users tweak the behavior of the alerting system simply by defining the labels/values of their alerts

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

The issue provides YAML examples for templated route matcher expressions using alert labels and functions, but names no files or tests. Start by tracing route matcher parsing and template handling; done means the proposed expressions work with label values and functions, with coverage for the examples shown.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.