Skip to content

proposal: Allow unquoted Unicode letters and dots in metric and label names - #94

Open
roidelapluie wants to merge 3 commits into
prometheus:mainfrom
roidelapluie:roidelapluie/utf8name
Open

roidelapluie wants to merge 3 commits into
prometheus:mainfrom
roidelapluie:roidelapluie/utf8name

Conversation

@roidelapluie

Copy link
Copy Markdown
Member

No description provided.

… names

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
@juliusv

juliusv commented Sep 14, 2026

Copy link
Copy Markdown
Member

Sounds good to me, thanks 👍

I don't know how annoying it will be to implement this behind a feature flag, especially since case differentiation in lexing/parsing (both backend + frontend) could become cumbersome. If that turns out to be too much trouble, maybe we can even relax the requirement that it needs to be behind a feature flag.

Btw. I started a vibe-coded implementation in https://github.com/prometheus/prometheus/tree/juliusv-vibe/promql-unquoted-dots a few weeks back just to explore things, see commit prometheus/prometheus@87e9695. That still doesn't cover everything (e.g. printing in the backend or frontend), but feel free to ignore that branch or use it as an inspiration (or copy whatever you like).

Maybe one thing to note that popped up in that session: the frontend's lezer parsing system does not have an equivalent of unicode.IsLetter, so this is the solution that Claude came up with:

  // Besides ASCII letters, names may contain any non-ASCII character that is a
  // letter. Since the tokenizer cannot check Unicode character classes, any
  // non-ASCII character is accepted here. Names containing non-letters still
  // have to be quoted, which the PromQL parser in Prometheus enforces.
  // The ranges below cover all non-ASCII characters except whitespace.
  nameLetter {
    std.asciiLetter |
    $[\u{a1}-\u{167f}\u{1681}-\u{1fff}\u{200b}-\u{2027}\u{202a}-\u{202e}\u{2030}-\u{205e}\u{2060}-\u{2fff}\u{3001}-\u{10ffff}]
  }
  Identifier { (nameLetter | "_" | ":") (nameLetter | std.digit | "_" | ":" | ".")* }
  LabelName { (nameLetter | "_") (nameLetter | std.digit | "_" | ".")* }

That sounds like it would allow the user to input characters that parse fine on the frontend but cause an error on the backend. Would be nice if there was a better solution, but I haven't looked into it myself yet.

@roidelapluie

Copy link
Copy Markdown
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants