prometheus / prometheus/client_rust

UTF8 Label Encoding

Open
#251 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
606
Forks
113
Avg merge
9h 7m
Merged PRs (30d)
8

Description

How should we encode utf8 labels?

if self.prometheus_full_utf8 {
    write!(&mut key_encoder, "{}", key)?;
} else {
    write!(&mut key_encoder, "{}", escape_label(key.as_str()))?;
}

I feel like doing something like this is less than ideal & that the key encoder itself should should either escape or not depending on the encoding (text or protobuf).

--

# HELP target_info Information about the target
# TYPE target_info info
target_info_info{service.name="xxx"} 1
# EOF

Contributor guide

Open the contributing guide

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 with the shown key_encoder path and compare the prometheus_full_utf8 branches, including escape_label and the text/protobuf encoding distinction. Determine the intended UTF-8 label encoding behavior and how it should apply across encodings; done means the project has a decided, consistent approach for the target_info example.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
observability-sre
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.