From 29fc3c281b2a2368e777e3349e646045eaa86b5c Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Fri, 30 Jun 2023 20:40:12 +0000 Subject: [PATCH] prometheus compatibility: do not require trimming suffixes by default --- CHANGELOG.md | 2 ++ .../compatibility/prometheus_and_openmetrics.md | 11 ++++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f60d04b1b17..747f572b03d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,8 @@ release. ### Compatibility +- Prometheus type and unit suffixes are not trimmed by default. ([#3580](https://github.com/open-telemetry/opentelemetry-specification/pull/3580)) + ### OpenTelemetry Protocol ### SDK Configuration diff --git a/specification/compatibility/prometheus_and_openmetrics.md b/specification/compatibility/prometheus_and_openmetrics.md index c49ac1ba1de..a71bd00588b 100644 --- a/specification/compatibility/prometheus_and_openmetrics.md +++ b/specification/compatibility/prometheus_and_openmetrics.md @@ -48,13 +48,10 @@ OpenTelemetry metric data. Since OpenMetrics has a superset of Prometheus' types ### Metric Metadata The [OpenMetrics MetricFamily Name](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#metricfamily) -MUST be added as the Name of the OTLP metric after the removal of unit and type -suffixes described below. +MUST be added as the Name of the OTLP metric. By default, the name MUST be unaltered, but translation SHOULD provide configuration which, when enabled, removes type (e.g. `_total`) and unit (e.g. `_seconds`) suffixes. The [OpenMetrics UNIT metadata](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#metricfamily), -if present, MUST be converted to the unit of the OTLP metric. After trimming -type-specific suffixes, such as `_total` for counters, the unit MUST be trimmed -from the suffix as well, if the metric suffix matches the unit. The unit SHOULD +if present, MUST be converted to the unit of the OTLP metric. The unit SHOULD be translated from Prometheus conventions to OpenTelemetry conventions by: * Converting from full words to abbreviations (e.g. "milliseconds" to "ms"). @@ -71,7 +68,7 @@ metadata follow rules for [unknown-typed](#unknown-typed) metrics below. ### Counters -A [Prometheus Counter](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#counter) MUST be converted to an OTLP Sum with `is_monotonic` equal to `true`. If the counter has a `_total` suffix, it MUST be removed. +A [Prometheus Counter](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#counter) MUST be converted to an OTLP Sum with `is_monotonic` equal to `true`. ### Gauges @@ -79,7 +76,7 @@ A [Prometheus Gauge](https://github.com/OpenObservability/OpenMetrics/blob/main/ ### Info -An [OpenMetrics Info](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#info) metric MUST be converted to an OTLP Non-Monotonic Sum unless it is the target_info metric, which is used to populate [resource attributes](#resource-attributes). An OpenMetrics Info can be thought of as a special-case of the OpenMetrics Gauge which has a value of 1, and whose labels generally stays constant over the life of the process. It is converted to a Non-Monotonic Sum, rather than a Gauge, because the value of 1 is intended to be viewed as a count, which should be summed together when aggregating away labels. If it has an `_info` suffix, the suffix MUST be removed from the metric name. +An [OpenMetrics Info](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#info) metric MUST be converted to an OTLP Non-Monotonic Sum unless it is the target_info metric, which is used to populate [resource attributes](#resource-attributes). An OpenMetrics Info can be thought of as a special-case of the OpenMetrics Gauge which has a value of 1, and whose labels generally stays constant over the life of the process. It is converted to a Non-Monotonic Sum, rather than a Gauge, because the value of 1 is intended to be viewed as a count, which should be summed together when aggregating away labels. ### StateSet