You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: specification/compatibility/prometheus_and_openmetrics.md
+53-1Lines changed: 53 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ aliases:
7
7
8
8
# Prometheus and OpenMetrics Compatibility
9
9
10
-
**Status**: [Development](../document-status.md)
10
+
**Status**: [Mixed](../document-status.md)
11
11
12
12
<details>
13
13
<summary>Table of Contents</summary>
@@ -78,8 +78,12 @@ at the time of writing:
78
78
79
79
## Prometheus Metric points to OTLP
80
80
81
+
**Status**: [Development](../document-status.md)
82
+
81
83
### Metric Metadata
82
84
85
+
**Status**: [Development](../document-status.md)
86
+
83
87
The [Prometheus Metric Name](https://prometheus.io/docs/instrumenting/exposition_formats/#comments-help-text-and-type-information)
84
88
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.
85
89
@@ -103,26 +107,38 @@ under the `prometheus.type` key (e.g. `prometheus.type="unknown"`).
103
107
104
108
### Counters
105
109
110
+
**Status**: [Development](../document-status.md)
111
+
106
112
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`.
107
113
108
114
### Gauges
109
115
116
+
**Status**: [Development](../document-status.md)
117
+
110
118
A [Prometheus Gauge](https://prometheus.io/docs/instrumenting/exposition_formats/#basic-info) MUST be converted to an OTLP Gauge.
111
119
112
120
### Info
113
121
122
+
**Status**: [Development](../document-status.md)
123
+
114
124
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.
115
125
116
126
### StateSet
117
127
128
+
**Status**: [Development](../document-status.md)
129
+
118
130
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.
119
131
120
132
### Unknown-typed
121
133
134
+
**Status**: [Development](../document-status.md)
135
+
122
136
A [Prometheus Unknown](https://prometheus.io/docs/instrumenting/exposition_formats/#basic-info) MUST be converted to an OTLP Gauge.
123
137
124
138
### Histograms
125
139
140
+
**Status**: [Development](../document-status.md)
141
+
126
142
A [Prometheus Histogram](https://prometheus.io/docs/instrumenting/exposition_formats/#basic-info) MUST be converted to an OTLP Histogram.
127
143
128
144
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
134
150
135
151
### Native Histograms
136
152
153
+
**Status**: [Development](../document-status.md)
154
+
137
155
A [Prometheus Native Histogram](https://prometheus.io/docs/specs/native_histograms/)
138
156
with standard (exponential) schema (i.e. schemas -4 to 8) and which are
139
157
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.
164
182
165
183
### Summaries
166
184
185
+
**Status**: [Development](../document-status.md)
186
+
167
187
[Prometheus Summary](https://prometheus.io/docs/instrumenting/exposition_formats/#basic-info) MUST be converted to an OTLP Summary.
168
188
169
189
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:
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.
can be attached to Prometheus Histogram bucket metric points and counter metric
191
217
points. Exemplars on histogram buckets SHOULD be converted to exemplars on
@@ -198,6 +224,8 @@ exemplar as attributes.
198
224
199
225
### Instrumentation Scope
200
226
227
+
**Status**: [Development](../document-status.md)
228
+
201
229
Labels with `otel_scope_` prefix MUST be dropped from all metric points
202
230
and used as the Instrumentation Scope name (`otel_scope_name`),
203
231
version (`otel_scope_version`), schema URL (`otel_scope_schema_url`),
@@ -234,6 +262,8 @@ prometheus receiver).
234
262
235
263
### Resource Attributes
236
264
265
+
**Status**: [Development](../document-status.md)
266
+
237
267
When scraping a Prometheus endpoint, resource attributes MUST be added to the
238
268
scraped metrics to distinguish them from metrics from other Prometheus
239
269
endpoints. In particular, `service.name` and `service.instance.id`, are needed
@@ -269,8 +299,12 @@ in keys).
269
299
270
300
## OTLP Metric points to Prometheus
271
301
302
+
**Status**: [Development](../document-status.md)
303
+
272
304
### Metric Metadata
273
305
306
+
**Status**: [Development](../document-status.md)
307
+
274
308
Prometheus Pull exporters MUST NOT allow duplicate UNIT, HELP, or TYPE
275
309
comments for the same metric name to be returned in a single scrape of the
276
310
Prometheus endpoint. Exporters MUST drop entire metrics to prevent conflicting
@@ -307,6 +341,8 @@ It also dictates type-specific conversion rules listed below.
307
341
308
342
### Instrumentation Scope
309
343
344
+
**Status**: [Development](../document-status.md)
345
+
310
346
Prometheus exporters MUST by default add
311
347
the scope name as the `otel_scope_name` label,
312
348
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
320
356
321
357
### Gauges
322
358
359
+
**Status**: [Development](../document-status.md)
360
+
323
361
An [OpenTelemetry Gauge](../metrics/data-model.md#gauge) MUST be converted to
324
362
a Prometheus Unknown-typed metric if the `prometheus.type` key of
325
363
[metric.metadata][metricMetadata] is `unknown`. Otherwise, it MUST be converted
326
364
to a Prometheus Gauge.
327
365
328
366
### Sums
329
367
368
+
**Status**: [Development](../document-status.md)
369
+
330
370
[OpenTelemetry Sums](../metrics/data-model.md#sums) follows this logic:
331
371
332
372
- 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
345
385
346
386
### Histograms
347
387
388
+
**Status**: [Development](../document-status.md)
389
+
348
390
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:
349
391
350
392
- 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
356
398
357
399
### Exponential Histograms
358
400
401
+
**Status**: [Development](../document-status.md)
402
+
359
403
An [OpenTelemetry Exponential Histogram](../metrics/data-model.md#exponentialhistogram) with
360
404
a cumulative aggregation temporality MUST be converted to a Prometheus Native
361
405
Histogram as follows:
@@ -391,6 +435,8 @@ metrics with the delta aggregation temporality are dropped.
391
435
392
436
### Summaries
393
437
438
+
**Status**: [Development](../document-status.md)
439
+
394
440
An [OpenTelemetry Summary](../metrics/data-model.md#summary-legacy) MUST be converted to a Prometheus metric family with the following metrics:
395
441
396
442
- 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
408
454
409
455
### Metric Attributes
410
456
457
+
**Status**: [Development](../document-status.md)
458
+
411
459
OpenTelemetry Metric Attributes MUST be converted to
String Attribute values are converted directly to Metric Attributes, and
@@ -424,6 +472,8 @@ the lexicographical order of the original keys.
424
472
425
473
### Exemplars
426
474
475
+
**Status**: [Development](../document-status.md)
476
+
427
477
[Exemplars](../metrics/data-model.md#exemplars) on OpenTelemetry Histograms and Monotonic Sums SHOULD
428
478
be converted to Prometheus exemplars. Exemplars on other OpenTelemetry data
429
479
points MUST be dropped. For Prometheus Remote Write exporters, multiple exemplars are
@@ -440,6 +490,8 @@ Prometheus exemplar unless they would exceed the
440
490
441
491
### Resource Attributes
442
492
493
+
**Status**: [Development](../document-status.md)
494
+
443
495
In Prometheus exporters, an OpenTelemetry Resource SHOULD be converted to
444
496
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)
445
497
if the resource is not [empty](../resource/sdk.md#the-empty-resource).
0 commit comments