From 31e988297d9c3f1f89c3915aec13df4be1348d94 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Thu, 6 Jul 2023 11:11:43 -0400 Subject: [PATCH] Prometheus compatibility: don't add duplicate _total suffixes (#3581) Clarifies that _total does not need to be added as a suffix to counters if it already exists. There was confusion in https://github.com/open-telemetry/opentelemetry-java/issues/5304#issuecomment-1523356583 if that was correct or not. --- CHANGELOG.md | 3 +++ specification/compatibility/prometheus_and_openmetrics.md | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba85575e65f..178d52f45f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,9 @@ release. ### Compatibility +- Prometheus: Do not add `_total` suffix if the metric already ends in `_total`. + ([#3581](https://github.com/open-telemetry/opentelemetry-specification/pull/3581)) + ### OpenTelemetry Protocol ### SDK Configuration diff --git a/specification/compatibility/prometheus_and_openmetrics.md b/specification/compatibility/prometheus_and_openmetrics.md index c49ac1ba1de..da005d248b5 100644 --- a/specification/compatibility/prometheus_and_openmetrics.md +++ b/specification/compatibility/prometheus_and_openmetrics.md @@ -279,7 +279,7 @@ An [OpenTelemetry Gauge](../metrics/data-model.md#gauge) MUST be converted to a - The new data point's start time must match the time of the accumulated data point. If not, see [detecting alignment issues](../metrics/data-model.md#sums-detecting-alignment-issues). - Otherwise, it MUST be dropped. -Monotonic Sum metric points MUST have `_total` added as a suffix to the metric name. +If the metric name for monotonic Sum metric points does not end in a suffix of `_total` a suffix of `_total` MUST be added, otherwise the name MUST remain unchanged. Monotonic Sum metric points with `StartTimeUnixNano` should export the `{name}_created` metric as well. ### Histograms