From a00c08be375d21a1d372075e8a5f46cb15233636 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Fri, 21 Oct 2022 13:27:50 -0400 Subject: [PATCH] Prevent duplicate Prometheus description comments (#2890) --- CHANGELOG.md | 3 +++ specification/metrics/data-model.md | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 298635bba94..153dc96a3c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,9 @@ release. ### Metrics +- Handle duplicate description comments during Prometheus conversion. + ([#2890](https://github.com/open-telemetry/opentelemetry-specification/pull/2890)) + ### Logs ### Resource diff --git a/specification/metrics/data-model.md b/specification/metrics/data-model.md index f74e2b72f2f..74b4e247705 100644 --- a/specification/metrics/data-model.md +++ b/specification/metrics/data-model.md @@ -1468,6 +1468,14 @@ in keys). #### Metric Metadata +Prometheus SDK exporters MUST NOT allow duplicate UNIT, HELP, or TYPE +comments for the same metric name to be returned in a single scrape of the +Prometheus endpoint. Exporters MUST drop entire metrics to prevent conflicting +TYPE comments, but SHOULD NOT drop metric points as a result of conflicting +UNIT or HELP comments. Instead, all but one of the conflicting UNIT and HELP +comments (but not metric points) SHOULD be dropped. If dropping a comment or +metric points, the exporter SHOULD warn the user through error logging. + The Name of an OTLP metric MUST be added as the [OpenMetrics MetricFamily Name](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#metricfamily), with unit and type suffixes added as described below. The metric name is