From 40a694e11a47811275b08b3e056a3d9c452d140e Mon Sep 17 00:00:00 2001 From: bwplotka Date: Mon, 30 Mar 2026 13:32:21 +0100 Subject: [PATCH 1/2] OM2: Metric/MetricFamily.Name escaping consistency Signed-off-by: bwplotka --- docs/specs/om/open_metrics_spec_2_0.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/specs/om/open_metrics_spec_2_0.md b/docs/specs/om/open_metrics_spec_2_0.md index 3ac1b99cd..1dbaa8e3b 100644 --- a/docs/specs/om/open_metrics_spec_2_0.md +++ b/docs/specs/om/open_metrics_spec_2_0.md @@ -683,6 +683,19 @@ There MUST NOT be an explicit separator between MetricFamilies. The next MetricF MetricFamilies MUST NOT be interleaved. +MetricFamily Name MUST have exactly the same characters as the Metric name for this MetricFamily. + +An invalid example would be: + +```openmetrics-add-eof +# TYPE "read_errors" counter +# HELP read_errors The number of errors in the read path for fooDb. +{"read_errors","service.name"="my_service"} 3482 +read_errors{"service.name"="my_service2"} 123 +``` + +In the above example, `read_errors` MUST either use escaped or non-escaped form but not both. + #### MetricFamily metadata There are four pieces of metadata: The MetricFamily name, TYPE, UNIT and HELP. An example of the metadata for a counter Metric called `foo_total` is: From add2d5e98423514b9cf645a03a98a880c4b9cdc0 Mon Sep 17 00:00:00 2001 From: Bartlomiej Plotka Date: Mon, 30 Mar 2026 14:55:58 +0100 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Bartlomiej Plotka Signed-off-by: Bartlomiej Plotka --- docs/specs/om/open_metrics_spec_2_0.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/specs/om/open_metrics_spec_2_0.md b/docs/specs/om/open_metrics_spec_2_0.md index 1dbaa8e3b..4a1030b45 100644 --- a/docs/specs/om/open_metrics_spec_2_0.md +++ b/docs/specs/om/open_metrics_spec_2_0.md @@ -683,9 +683,9 @@ There MUST NOT be an explicit separator between MetricFamilies. The next MetricF MetricFamilies MUST NOT be interleaved. -MetricFamily Name MUST have exactly the same characters as the Metric name for this MetricFamily. +The same MetricFamily's Name and Metric's Name SHOULD have the same quoting. -An invalid example would be: +An example that would violate this: ```openmetrics-add-eof # TYPE "read_errors" counter @@ -694,8 +694,6 @@ An invalid example would be: read_errors{"service.name"="my_service2"} 123 ``` -In the above example, `read_errors` MUST either use escaped or non-escaped form but not both. - #### MetricFamily metadata There are four pieces of metadata: The MetricFamily name, TYPE, UNIT and HELP. An example of the metadata for a counter Metric called `foo_total` is: