-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
Currently, Alertmanager supports only valid Prometheus label names, i.e. the ones that match the following regular expression ^[a-zA-Z_][a-zA-Z0-9_]*$.
This is a quite restrictive pattern and limits usage of the Alertmanager outside the Prometheus eco-system.
For example. Grafana uses Alertmanager for notifications, and because Grafana supports many different data sources (like Elasticsearch, Graphite, SQL, etc) where the format of label names usually does fit into a narrow range of characters Alertmanager accepts, it works around the limitation by overriding API level and config parsing logic.
I propose a feature request to expand the range of the allowed symbols in label names to accept any UTF-8 characters.
Looking at the code I did not find any technical limitations that would prevent Alertmanager from working with label names that contain any UTF-8 characters, and change is fairly simple.
The only problem spot is the parsing of Matchers
alertmanager/pkg/labels/parse.go
Lines 47 to 56 in 432ee01
| // Examples for valid input strings: | |
| // | |
| // {foo = "bar", dings != "bums", } | |
| // foo=bar,dings!=bums | |
| // foo=bar, dings!=bums | |
| // {quote="She said: \"Hi, ladies! That's gender-neutral…\""} | |
| // statuscode=~"5.." | |
| // | |
| // See ParseMatcher for details on how an individual Matcher is parsed. | |
| func ParseMatchers(s string) ([]*Matcher, error) { |
"foo"=bar,dings!=bums
{"quote"="She said: \"Hi, ladies! That's gender-neutral…\""}
The idea is to distinguish between matcher type symbols (=~|=|!=|!~) and those sequences in label names. For example
"~=labeltest=~"=~"good label"
Metadata
Metadata
Assignees
Type
Projects
Status