You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Metric and label names not conforming to the ABNF definition of `metricname` MUST be enclosed in double quotes and the alternative UTF-8 syntax MUST be used.
451
+
Quoting and the alternative metric name syntax MAY be used for any metric name, regardless of whether the name conforms to `metricname` or not.
452
+
The metric names MUST be enclosed in double quotes in TYPE, UNIT, and HELP lines. The metric name MUST be moved inside the brackets without an operator, in accordance with the ABNF.
453
+
Label names not conforming to the `label-name` ABNF definition MUST be enclosed in double quotes. Any label name MAY be enclosed in double quotes.
454
+
455
+
Complete example:
456
+
457
+
```openmetrics
458
+
# TYPE "process.cpu.seconds" counter
459
+
# UNIT "process.cpu.seconds" seconds
460
+
# HELP "process.cpu.seconds" Total user and system CPU time spent in seconds.
# HELP "quoting_example" Number of goroutines that currently exist.
464
+
{"quoting_example", "foo"="bar"} 4.5
442
465
# EOF
443
466
```
444
467
@@ -538,6 +561,8 @@ The value of a UNIT or HELP line MAY be empty. This MUST be treated as if no met
538
561
# HELP foo_seconds Some text and \n some \" escaping
539
562
```
540
563
564
+
See the UTF-8 Quoting section for circumstances where the metric name MUST be enclosed in double quotes.
565
+
541
566
There MUST NOT be more than one of each type of metadata line for a MetricFamily. The ordering SHOULD be TYPE, UNIT, HELP.
542
567
543
568
Aside from this metadata and the EOF line at the end of the message, you MUST NOT expose lines beginning with a #.
@@ -566,6 +591,13 @@ Label values MAY be any valid UTF-8 value, so escaping MUST be applied as per th
566
591
bar_seconds_count{a="x",b="escaping\" example \n "} 0
567
592
```
568
593
594
+
Metric names and label names MAY also be any valid UTF-8 value, and under certain circumstances they MUST be quoted and escaped per the ABNF.
595
+
See the UTF-8 Quoting section for specifics.
596
+
597
+
```openmetrics-add-eof
598
+
{ "\"bar\".seconds.count", "b\\"="escaping\" example \n "} 0
599
+
```
600
+
569
601
The rendering of values for a MetricPoint can include additional labels (e.g. the "le" label for a Histogram type), which MUST be rendered in the same way as a Metric's own LabelSet.
0 commit comments