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
+24-18
Original file line number
Diff line number
Diff line change
@@ -139,15 +139,13 @@ exemplar as attributes.
139
139
140
140
### Instrumentation Scope
141
141
142
-
Each `otel_scope_info` metric point present in a batch of metrics
143
-
SHOULD be dropped from the incoming scrape, and converted to an instrumentation
144
-
scope. The `otel_scope_name` and `otel_scope_version` labels, if present, MUST
145
-
be converted to the Name and Version of the Instrumentation Scope. Additional
146
-
labels MUST be added as scope attributes, with keys and values unaltered. Other
147
-
metrics in the batch which have `otel_scope_name` and `otel_scope_version`
148
-
labels that match an instrumentation scope MUST be placed within the matching
149
-
instrumentation scope, and MUST remove those labels. For example, the
150
-
OpenMetrics metrics:
142
+
The `otel_scope_name` and `otel_scope_version` lables, if present, SHOULD be
143
+
dropped from all metric points and used as the Instrumentation Scope name and
144
+
version respectively. All `otel_scope_info` metrics present in a batch
145
+
of metrics SHOULD be dropped from the incoming scrape. Labels on
146
+
`otel_scope_info` metric points other than `otel_scope_name` and
147
+
`otel_scope_version`, MUST be added as scope attributes to the scope with the
148
+
matching name and version. For example, the OpenMetrics metrics:
151
149
152
150
```
153
151
# TYPE otel_scope_info info
@@ -174,9 +172,10 @@ scope_metrics:
174
172
- value: 1
175
173
```
176
174
177
-
Metrics which are not found to be associated with an instrumentation scope MUST
178
-
all be placed within an empty instrumentation scope, and MUST not have any labels
179
-
removed.
175
+
Metrics which do not have an `otel_scope_name` or `otel_scope_version` label
176
+
MUST be assigned an instrumentation scope identifying the entity performing
177
+
the translation from Prometheus to OpenTelemetry (e.g. the collector's
178
+
prometheus receiver).
180
179
181
180
### Resource Attributes
182
181
@@ -255,11 +254,11 @@ It also dictates type-specific conversion rules listed below.
255
254
### Instrumentation Scope
256
255
257
256
Prometheus exporters SHOULD generate an [Info](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#info)-typed
258
-
metric named `otel_scope_info`. If present, Instrumentation Scope
259
-
`name`and `version` MUST be added as `otel_scope_name` and
260
-
`otel_scope_version`labels. Scope attributes MUST also be added as labels
261
-
following the rules described in the [`Metric Attributes`](#metric-attributes)
262
-
section below.
257
+
metric named `otel_scope_info` for each Instrumentation Scope with non-empty
258
+
scope attributes. If present, Instrumentation Scope `name` and `version` MUST
259
+
be added as `otel_scope_name` and `otel_scope_version` labels. Scope attributes
260
+
MUST also be added as labels following the rules described in the
Prometheus exporters MUST add the scope name as the `otel_scope_name` label and
265
264
the scope version as the `otel_scope_version` label on all metric points by
@@ -384,7 +383,14 @@ OpenMetrics exemplar unless they would exceed the OpenMetrics
384
383
385
384
### Resource Attributes
386
385
387
-
In SDK Prometheus (pull) exporters, resource attributes SHOULD be converted to a single [`target_info` metric](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#supporting-target-metadata-in-both-push-based-and-pull-based-systems); otherwise, they MUST be dropped, and MUST NOT be attached as labels to other metric families. The target_info metric MUST be an info-typed metric whose labels MUST include the resource attributes, and MUST NOT include any other labels. There MUST be at most one target_info metric exposed on an SDK Prometheus endpoint.
386
+
In SDK Prometheus (pull) exporters, resource attributes SHOULD be converted to
387
+
a single [`target_info` metric](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#supporting-target-metadata-in-both-push-based-and-pull-based-systems)
388
+
if the resource is not [empty](../resource/sdk.md#the-empty-resource);
389
+
otherwise, they MUST be dropped, and MUST NOT be attached as labels to other
390
+
metric families. The target_info metric MUST be an info-typed metric whose
391
+
labels MUST include the resource attributes, and MUST NOT include any other
392
+
labels. There MUST be at most one target_info metric exposed on an SDK
393
+
Prometheus endpoint.
388
394
389
395
In the Collector's Prometheus pull and push (remote-write) exporters, it is
390
396
possible for metrics from multiple targets to be sent together, so targets must
0 commit comments