Skip to content

Commit c036b43

Browse files
authored
Set Prometheus<->OTLP specification to Mixed stability (#4860)
## Changes The Prometheus SIG plans to work on stabilizing the Prometheus<->OTLP specification in the next few months. This PR is the first step towards it. We're setting the stability level to `Mixed`, so we can tackle each part of the spec individually and in incremental PRs and discussions. cc @dashpole * [X] Related issues #4742 * [ ] Related [OTEP(s)](https://github.com/open-telemetry/oteps) # * [ ] Links to the prototypes (when adding or changing features) * [ ] [`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 Signed-off-by: Arthur Silva Sens <[email protected]>
1 parent 343c2ab commit c036b43

File tree

1 file changed

+53
-1
lines changed

1 file changed

+53
-1
lines changed

specification/compatibility/prometheus_and_openmetrics.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ aliases:
77

88
# Prometheus and OpenMetrics Compatibility
99

10-
**Status**: [Development](../document-status.md)
10+
**Status**: [Mixed](../document-status.md)
1111

1212
<details>
1313
<summary>Table of Contents</summary>
@@ -78,8 +78,12 @@ at the time of writing:
7878

7979
## Prometheus Metric points to OTLP
8080

81+
**Status**: [Development](../document-status.md)
82+
8183
### Metric Metadata
8284

85+
**Status**: [Development](../document-status.md)
86+
8387
The [Prometheus Metric Name](https://prometheus.io/docs/instrumenting/exposition_formats/#comments-help-text-and-type-information)
8488
MUST be added as the Name of the OTLP metric. By default, the name SHOULD NOT be altered, but translation SHOULD provide configuration which, when enabled, removes type (e.g. `_total`) and unit (e.g. `_seconds`) suffixes.
8589

@@ -103,26 +107,38 @@ under the `prometheus.type` key (e.g. `prometheus.type="unknown"`).
103107

104108
### Counters
105109

110+
**Status**: [Development](../document-status.md)
111+
106112
A [Prometheus Counter](https://prometheus.io/docs/instrumenting/exposition_formats/#basic-info) MUST be converted to an OTLP Sum with `is_monotonic` equal to `true`.
107113

108114
### Gauges
109115

116+
**Status**: [Development](../document-status.md)
117+
110118
A [Prometheus Gauge](https://prometheus.io/docs/instrumenting/exposition_formats/#basic-info) MUST be converted to an OTLP Gauge.
111119

112120
### Info
113121

122+
**Status**: [Development](../document-status.md)
123+
114124
A [Prometheus Info](https://github.com/prometheus/OpenMetrics/blob/v1.0.0/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). A Prometheus Info metric can be thought of as a special-case of the Prometheus Gauge metric which has a value of 1, and whose labels generally stays constant over the life of the process. It is converted to a OTLP Non-Monotonic Sum, rather than an OTLP Gauge, because the value of 1 is intended to be viewed as a count, which should be summed together when aggregating away labels.
115125

116126
### StateSet
117127

128+
**Status**: [Development](../document-status.md)
129+
118130
A [Prometheus StateSet](https://github.com/prometheus/OpenMetrics/blob/v1.0.0/specification/OpenMetrics.md#stateset) metric MUST be converted to an OTLP Non-Monotonic Sum. A Prometheus StateSet metric can be thought of as a special-case of the Prometheus Gauge which has a 0 or 1 value, and has one metric point for every possible state. It is converted to an OTLP Non-Monotonic Sum, rather than an OTLP Gauge, because the value of 1 is intended to be viewed as a count, which should be summed together when aggregating away labels.
119131

120132
### Unknown-typed
121133

134+
**Status**: [Development](../document-status.md)
135+
122136
A [Prometheus Unknown](https://prometheus.io/docs/instrumenting/exposition_formats/#basic-info) MUST be converted to an OTLP Gauge.
123137

124138
### Histograms
125139

140+
**Status**: [Development](../document-status.md)
141+
126142
A [Prometheus Histogram](https://prometheus.io/docs/instrumenting/exposition_formats/#basic-info) MUST be converted to an OTLP Histogram.
127143

128144
Multiple Prometheus histogram metrics MUST be merged together into a single OTLP Histogram:
@@ -134,6 +150,8 @@ Multiple Prometheus histogram metrics MUST be merged together into a single OTLP
134150

135151
### Native Histograms
136152

153+
**Status**: [Development](../document-status.md)
154+
137155
A [Prometheus Native Histogram](https://prometheus.io/docs/specs/native_histograms/)
138156
with standard (exponential) schema (i.e. schemas -4 to 8) and which are
139157
of the integer and counter [flavor](https://prometheus.io/docs/specs/native_histograms/#flavors)
@@ -164,6 +182,8 @@ Native Histograms with `Schema` outside of the range [-4, 8] MUST be dropped.
164182

165183
### Summaries
166184

185+
**Status**: [Development](../document-status.md)
186+
167187
[Prometheus Summary](https://prometheus.io/docs/instrumenting/exposition_formats/#basic-info) MUST be converted to an OTLP Summary.
168188

169189
Multiple Prometheus metrics are merged together into a single OTLP Summary:
@@ -175,17 +195,23 @@ Multiple Prometheus metrics are merged together into a single OTLP Summary:
175195

176196
### Dropped Types
177197

198+
**Status**: [Development](../document-status.md)
199+
178200
The following Prometheus types MUST be dropped:
179201

180202
* [Prometheus GaugeHistogram](https://github.com/prometheus/OpenMetrics/blob/v1.0.0/specification/OpenMetrics.md#gaugehistogram)
181203
* [Prometheus Native GaugeHistogram](https://prometheus.io/docs/specs/native_histograms/#gauge-histograms-vs-counter-histograms)
182204

183205
### Start Time
184206

207+
**Status**: [Development](../document-status.md)
208+
185209
Prometheus Cumulative metrics can include the start time using the [`_created` sample series](https://github.com/prometheus/OpenMetrics/blob/v1.0.0/specification/OpenMetrics.md#counter-1). When converting Prometheus Counters to OTLP, conversion SHOULD use `_created` where available. When no `_created` metric is available, conversion MUST follow [Cumulative streams: handling unknown start time](../metrics/data-model.md#cumulative-streams-handling-unknown-start-time) by default. Conversion MAY offer configuration, disabled by default, which allows using the `process_start_time_seconds` metric to provide the start time. Using `process_start_time_seconds` is only correct when all counters on the target start after the process and are not reset while the process is running.
186210

187211
### Exemplars
188212

213+
**Status**: [Development](../document-status.md)
214+
189215
[Prometheus Exemplars](https://github.com/prometheus/OpenMetrics/blob/v1.0.0/specification/OpenMetrics.md#exemplars)
190216
can be attached to Prometheus Histogram bucket metric points and counter metric
191217
points. Exemplars on histogram buckets SHOULD be converted to exemplars on
@@ -198,6 +224,8 @@ exemplar as attributes.
198224

199225
### Instrumentation Scope
200226

227+
**Status**: [Development](../document-status.md)
228+
201229
Labels with `otel_scope_` prefix MUST be dropped from all metric points
202230
and used as the Instrumentation Scope name (`otel_scope_name`),
203231
version (`otel_scope_version`), schema URL (`otel_scope_schema_url`),
@@ -234,6 +262,8 @@ prometheus receiver).
234262

235263
### Resource Attributes
236264

265+
**Status**: [Development](../document-status.md)
266+
237267
When scraping a Prometheus endpoint, resource attributes MUST be added to the
238268
scraped metrics to distinguish them from metrics from other Prometheus
239269
endpoints. In particular, `service.name` and `service.instance.id`, are needed
@@ -269,8 +299,12 @@ in keys).
269299

270300
## OTLP Metric points to Prometheus
271301

302+
**Status**: [Development](../document-status.md)
303+
272304
### Metric Metadata
273305

306+
**Status**: [Development](../document-status.md)
307+
274308
Prometheus Pull exporters MUST NOT allow duplicate UNIT, HELP, or TYPE
275309
comments for the same metric name to be returned in a single scrape of the
276310
Prometheus endpoint. Exporters MUST drop entire metrics to prevent conflicting
@@ -307,6 +341,8 @@ It also dictates type-specific conversion rules listed below.
307341

308342
### Instrumentation Scope
309343

344+
**Status**: [Development](../document-status.md)
345+
310346
Prometheus exporters MUST by default add
311347
the scope name as the `otel_scope_name` label,
312348
the scope version as the `otel_scope_version` label,
@@ -320,13 +356,17 @@ to avoid conflicts with the already existing `otel_scope_name`, `otel_scope_vers
320356

321357
### Gauges
322358

359+
**Status**: [Development](../document-status.md)
360+
323361
An [OpenTelemetry Gauge](../metrics/data-model.md#gauge) MUST be converted to
324362
a Prometheus Unknown-typed metric if the `prometheus.type` key of
325363
[metric.metadata][metricMetadata] is `unknown`. Otherwise, it MUST be converted
326364
to a Prometheus Gauge.
327365

328366
### Sums
329367

368+
**Status**: [Development](../document-status.md)
369+
330370
[OpenTelemetry Sums](../metrics/data-model.md#sums) follows this logic:
331371

332372
- If the aggregation temporality is cumulative and the sum is monotonic, it MUST be converted to a Prometheus Counter.
@@ -345,6 +385,8 @@ Monotonic Sum metric points with `StartTimeUnixNano` should export the `{name}_c
345385

346386
### Histograms
347387

388+
**Status**: [Development](../document-status.md)
389+
348390
An [OpenTelemetry Histogram](../metrics/data-model.md#histogram) with a cumulative aggregation temporality MUST be converted to a Prometheus metric family with the following metrics:
349391

350392
- A single `{name}_count` metric denoting the count field of the histogram. All attributes of the histogram point are converted to Prometheus labels.
@@ -356,6 +398,8 @@ OpenTelemetry Histograms with Delta aggregation temporality SHOULD be aggregated
356398

357399
### Exponential Histograms
358400

401+
**Status**: [Development](../document-status.md)
402+
359403
An [OpenTelemetry Exponential Histogram](../metrics/data-model.md#exponentialhistogram) with
360404
a cumulative aggregation temporality MUST be converted to a Prometheus Native
361405
Histogram as follows:
@@ -391,6 +435,8 @@ metrics with the delta aggregation temporality are dropped.
391435

392436
### Summaries
393437

438+
**Status**: [Development](../document-status.md)
439+
394440
An [OpenTelemetry Summary](../metrics/data-model.md#summary-legacy) MUST be converted to a Prometheus metric family with the following metrics:
395441

396442
- A single `{name}_count` metric denoting the count field of the summary.
@@ -408,6 +454,8 @@ An [OpenTelemetry Summary](../metrics/data-model.md#summary-legacy) MUST be conv
408454

409455
### Metric Attributes
410456

457+
**Status**: [Development](../document-status.md)
458+
411459
OpenTelemetry Metric Attributes MUST be converted to
412460
[Prometheus labels](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
413461
String Attribute values are converted directly to Metric Attributes, and
@@ -424,6 +472,8 @@ the lexicographical order of the original keys.
424472

425473
### Exemplars
426474

475+
**Status**: [Development](../document-status.md)
476+
427477
[Exemplars](../metrics/data-model.md#exemplars) on OpenTelemetry Histograms and Monotonic Sums SHOULD
428478
be converted to Prometheus exemplars. Exemplars on other OpenTelemetry data
429479
points MUST be dropped. For Prometheus Remote Write exporters, multiple exemplars are
@@ -440,6 +490,8 @@ Prometheus exemplar unless they would exceed the
440490

441491
### Resource Attributes
442492

493+
**Status**: [Development](../document-status.md)
494+
443495
In Prometheus exporters, an OpenTelemetry Resource SHOULD be converted to
444496
a [`target` info metric](https://github.com/prometheus/OpenMetrics/blob/v1.0.0/specification/OpenMetrics.md#supporting-target-metadata-in-both-push-based-and-pull-based-systems)
445497
if the resource is not [empty](../resource/sdk.md#the-empty-resource).

0 commit comments

Comments
 (0)