Skip to content

Commit 7f0e5bc

Browse files
authored
docs: explain quoted Unicode metric names (#2571)
## Summary Clarify how metric names outside the legacy character set are represented when `escaping=allow-utf-8` is used with the Prometheus and OpenMetrics 1.0 text formats. The documentation now: - Explains that non-legacy metric names must use quoted syntax. - Clarifies why quoted metric names appear inside braces. - Includes an example using a Unicode counter name. - Links to the complete Prometheus exposition format specification. The reported output is valid text-format syntax rather than an encoding error. Closes #1576. ## Testing NA Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
1 parent 7d79d30 commit 7f0e5bc

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎docs/content/exporters/unicode.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ When `escaping=allow-utf-8` is passed, add valid UTF-8 characters to the metric
2626
without replacing them. This allows you to use dots in metric and label names, as well as
2727
other UTF-8 characters, without any replacements.
2828

29+
Names outside the legacy character set must use the quoted syntax in the Prometheus and
30+
OpenMetrics 1.0 text formats. A quoted metric name is written inside braces, followed by its
31+
labels. For example, a counter named `test_我喜欢茶` with a `test` label is exposed as:
32+
33+
```text
34+
# TYPE "test_我喜欢茶" counter
35+
{"test_我喜欢茶_total",test="test_我喜欢茶"} 1.0
36+
```
37+
38+
The braces do not turn the metric name into a label. They are the required text-format notation
39+
for a quoted metric name. See the [Prometheus exposition
40+
format](https://prometheus.io/docs/instrumenting/exposition_formats/) for the complete syntax.
41+
2942
OpenMetrics 2.0 supports UTF-8 names natively, so when the OpenMetrics 2.0 writer serves a request
3043
that explicitly asks for `version=2.0.0`, names are not escaped unless the request also contains an
3144
`escaping` parameter.

0 commit comments

Comments
 (0)