Skip to content

Epic: Support UTF-8 characters in Alertmanager label matchers #3486

Closed
@grobinson-grafana

Description

@grobinson-grafana

What

The Prometheus maintainers have agreed to support UTF-8 label matchers in Alertmanager. This issue tracks the work being done to deliver this change in Alertmanager.

Background

To support UTF-8 label matchers in Alertmanager we have restricted the grammar for label matchers and written a new LL(1) parser to parse this grammar. Our motivation for doing this, instead of extending the existing regular expression parser, is that we found a number of ambiguities in the existing grammar and parser that would have been made worse if we added support for UTF-8 label matchers. You can find a presentation that explains these ambiguities here.

Examples of ambiguities

{foo=}} equivalent to {foo="}"}, but I think this should be an error
{{foo=} is an error because of two {{, unlike the above
{foo=~} could be either {foo=~""} or {foo="~"}, it's interpreted in current versions as {foo=~""}
{foo=,} is equivalent to {foo=""}, but I think should be an error as a comma with no value has a high likelihood of being human error
{foo=,,} is an error, unlike {foo=,} or {foo=}}
{foo= } is equivalent to {foo=""}
{foo= }b is equivalent to {foo="}b"}
{foo= b} and {foo=b } are equivalent to {foo="b"}, but {foo=b b} is equivalent to {foo="b b"}
Example Can parse?
{foo=bar😊}
{foo="bar😊"}
{foo😊=bar}
{"foo😊"=bar}

Here bar😊 is allowed on the right hand side of the expression without quotes but not the left.

Tasks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions