Skip to content

Commit e6284fc

Browse files
Stabilize OTLP->Prometheus: Gauges and Sums (#5034)
Fixes #4919 Fixes #4920 ## Changes Stabilizes the converstion of OTLP Gauges and Sums to their Prometheus counterparts. For non-trivial changes, follow the [change proposal process](https://github.com/open-telemetry/opentelemetry-specification/blob/main/CONTRIBUTING.md#proposing-a-change). * [X] Related issues #4919, #4920 * [ ] Related [OTEP(s)](https://github.com/open-telemetry/oteps) # * [ ] Links to the prototypes (when adding or changing features) * [x] [`CHANGELOG.md`](https://github.com/open-telemetry/opentelemetry-specification/blob/main/CHANGELOG.md) file updated for non-trivial changes * For trivial changes, include `[chore]` in the PR title to skip the changelog check * [ ] [Spec compliance matrix](https://github.com/open-telemetry/opentelemetry-specification/blob/main/spec-compliance-matrix/template.yaml) updated if necessary * [ ] [Declarative config data model](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/data-model.md#overview) is updated if SDK config surface is changed --------- Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com> Co-authored-by: Jack Berg <34418638+jack-berg@users.noreply.github.com>
1 parent 9a5c8ed commit e6284fc

2 files changed

Lines changed: 18 additions & 16 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ release.
3535

3636
### Compatibility
3737

38+
- Stabilize sections of Prometheus and OpenMetrics Compatibility.
39+
- Stabilize OpenTelemetry Gauge and Sum to Prometheus transformations.
40+
([#5034](https://github.com/open-telemetry/opentelemetry-specification/pull/5034))
41+
3842
### SDK Configuration
3943

4044
### Supplementary Guidelines

specification/compatibility/prometheus_and_openmetrics.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -466,34 +466,32 @@ to avoid conflicts with the already existing `otel_scope_name`, `otel_scope_vers
466466

467467
### Gauges
468468

469-
**Status**: [Development](../document-status.md)
469+
**Status**: [Stable](../document-status.md)
470470

471-
An [OpenTelemetry Gauge](../metrics/data-model.md#gauge) MUST be converted to
472-
a Prometheus Unknown-typed metric if the `prometheus.type` key of
473-
[metric.metadata][metricMetadata] is `unknown`. Otherwise, it MUST be converted
474-
to a Prometheus Gauge.
471+
An [OpenTelemetry Gauge](../metrics/data-model#gauge) MUST be converted following
472+
a hint present in [metric.metadata][metricMetadata]:
473+
- If the `prometheus.type` key is absent, or its value is equal to `gauge`, the datapoint MUST be transformed to a Prometheus Gauge.
474+
- If the `prometheus.type` key has value equal to `unkown`, the datapoint MUST be transformed to a Prometheus Unknown.
475+
- If the `prometheus.type` key has value equal to `info`, the datapoint SHOULD be transformed to a Prometheus Info.
476+
- If the `prometheus.type` key has value equal to `stateset`, the datapoint SHOULD be transformed to a Prometheus Stateset.
475477

476478
Exemplars on OpenTelemetry Gauges SHOULD be dropped.
477479

478480
### Sums
479481

480-
**Status**: [Development](../document-status.md)
482+
**Status**: [Stable](../document-status.md)
481483

482-
[OpenTelemetry Sums](../metrics/data-model.md#sums) follows this logic:
484+
An [OpenTelemetry Sum](../metrics/data-model.md#sums) MUST be converted following the rules below:
483485

484486
- If the aggregation temporality is cumulative and the sum is monotonic, it MUST be converted to a Prometheus Counter.
485-
- If the aggregation temporality is cumulative and the sum is non-monotonic and the `prometheus.type` key of
486-
[metric.metadata][metricMetadata] is `info`, it MUST be converted to an OpenMetrics Info metric.
487-
- If the aggregation temporality is cumulative and the sum is non-monotonic and the `prometheus.type` key of
488-
[metric.metadata][metricMetadata] is `stateset`, it MUST be converted to an OpenMetrics StateSet metric.
489-
- If the aggregation temporality is cumulative and the sum is non-monotonic, it MUST be converted to a Prometheus Gauge.
490-
- If the aggregation temporality is delta and the sum is monotonic, it SHOULD be converted to a cumulative temporality and become a Prometheus Counter. The following behaviors are expected:
487+
- If the aggregation temporality is cumulative and the sum is non-monotonic, it should follow the same rules as described for [OpenTelemetry Gauge](#gauges-1)
488+
- If the aggregation temporality is delta and the sum is monotonic, it MAY be converted to a cumulative temporality and become a Prometheus Counter. The following behaviors are expected:
491489
- The new data point type must be the same as the accumulated data point type.
492490
- 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).
493-
- Otherwise, it MUST be dropped.
494491

495-
If the metric name for monotonic Sum metric points does not end in a suffix of `_total` a suffix of `_total` SHOULD be added by default, otherwise the name MUST remain unchanged. Exporters SHOULD provide a configuration option to disable the addition of `_total` suffixes.
496-
Monotonic Sum metric points with `StartTimeUnixNano` should export the `{name}_created` metric as well.
492+
If the metric name for monotonic Sum metric points does not end in a suffix of `_total` a suffix of `_total` SHOULD be added by default, otherwise the name MUST remain unchanged.
493+
494+
Monotonic Sum metric points with `StartTimeUnixNano` SHOULD transform `StartTimeUnixNano` into Prometheus `StartTime`, following the appropriate format used by each Prometheus protocol.
497495

498496
If Sum is converted to a Prometheus Counter, then `Exemplars` MUST be converted
499497
as described in the [Exemplar Conversion](#exemplar-conversion) section.

0 commit comments

Comments
 (0)