diff --git a/CHANGELOG.md b/CHANGELOG.md index aabb68ba04b..45a5efb9b52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,15 @@ release. ### Metrics +- Prometheus receiver can expect `otel_scope_schema_url` and `otel_scope_[attribute]` labels on all metrics. + ([#4505](https://github.com/open-telemetry/opentelemetry-specification/pull/4505)) +- Prometheus receiver no longer expects `otel_scope_info` metric. + ([#4505](https://github.com/open-telemetry/opentelemetry-specification/pull/4505)) +- Prometheus exporter adds `otel_scope_schema_url` and `otel_scope_[attribute]` labels on all metrics. + ([#4505](https://github.com/open-telemetry/opentelemetry-specification/pull/4505)) +- Prometheus exporter no longer exports `otel_scope_info` metric. + ([#4505](https://github.com/open-telemetry/opentelemetry-specification/pull/4505)) + ### Logs ### Baggage diff --git a/spec-compliance-matrix.md b/spec-compliance-matrix.md index c15f1b0c25e..fb0d100db90 100644 --- a/spec-compliance-matrix.md +++ b/spec-compliance-matrix.md @@ -355,8 +355,8 @@ Disclaimer: Declarative configuration is currently in Development status - work | [HELP Metadata](specification/compatibility/prometheus_and_openmetrics.md#metric-metadata-1) | | + | + | + | + | - | - | - | + | + | + | + | | [TYPE Metadata](specification/compatibility/prometheus_and_openmetrics.md#metric-metadata-1) | | + | + | + | + | - | - | - | + | + | + | + | | [otel_scope_name and otel_scope_version labels on all Metrics](specification/compatibility/prometheus_and_openmetrics.md#instrumentation-scope-1) | | + | + | - | - | - | - | - | + | - | - | - | -| [otel_scope_info metric](specification/compatibility/prometheus_and_openmetrics.md#instrumentation-scope-1) | X | + | + | - | - | - | - | - | + | - | - | - | -| [otel_scope_info and labels can be disabled](specification/compatibility/prometheus_and_openmetrics.md#instrumentation-scope-1) | X | + | - | - | - | - | - | - | + | - | - | - | +| [otel_scope_[attribute] labels on all Metrics](specification/compatibility/prometheus_and_openmetrics.md#instrumentation-scope-1) | | + | - | - | - | - | - | - | - | - | - | - | +| [otel_scope labels can be disabled](specification/compatibility/prometheus_and_openmetrics.md#instrumentation-scope-1) | X | + | - | - | - | - | - | - | + | - | - | - | | [Gauges become Prometheus Gauges](specification/compatibility/prometheus_and_openmetrics.md#gauges-1) | | + | + | + | + | - | - | - | + | + | + | - | | [Cumulative Monotonic Sums become Prometheus Counters](specification/compatibility/prometheus_and_openmetrics.md#sums) | | + | + | + | + | - | - | - | + | + | + | + | | [Prometheus Counters have _total suffix by default](specification/compatibility/prometheus_and_openmetrics.md#sums) | | + | + | + | + | - | - | - | + | - | - | - | diff --git a/specification/compatibility/prometheus_and_openmetrics.md b/specification/compatibility/prometheus_and_openmetrics.md index 07b69de59e1..b9caffe6128 100644 --- a/specification/compatibility/prometheus_and_openmetrics.md +++ b/specification/compatibility/prometheus_and_openmetrics.md @@ -166,19 +166,14 @@ exemplar as attributes. ### Instrumentation Scope -The `otel_scope_name` and `otel_scope_version` lables, if present, SHOULD be -dropped from all metric points and used as the Instrumentation Scope name and -version respectively. All `otel_scope_info` metrics present in a batch -of metrics SHOULD be dropped from the incoming scrape. Labels on -`otel_scope_info` metric points other than `otel_scope_name` and -`otel_scope_version`, MUST be added as scope attributes to the scope with the -matching name and version. For example, the OpenMetrics text-formatted metrics: +Labels with `otel_scope_` prefix MUST be dropped from all metric points +and used as the Instrumentation Scope name (`otel_scope_name`), +version (`otel_scope_version`), schema URL (`otel_scope_schema_url`), +attributes (`otel_scope_[attribute]`). ``` -# TYPE otel_scope_info info -otel_scope_info{otel_scope_name="go.opentelemetry.io.contrib.instrumentation.net.http.otelhttp",otel_scope_version="v0.24.0",library_mascot="bear"} 1 # TYPE http_server_duration counter -http_server_duration{otel_scope_name="go.opentelemetry.io.contrib.instrumentation.net.http.otelhttp",otel_scope_version="v0.24.0"...} 1 +http_server_duration{otel_scope_name="go.opentelemetry.io.contrib.instrumentation.net.http.otelhttp",otel_scope_schema_url="https://opentelemetry.io/schemas/1.31.0",otel_scope_version="v0.24.0",otel_scope_library_mascot="gopher"...} 1 ``` becomes: @@ -190,7 +185,8 @@ scope_metrics: name: go.opentelemetry.io.contrib.instrumentation.net.http.otelhttp version: v0.24.0 attributes: - library_mascot: bear + library_mascot: gopher + schema_url: https://opentelemetry.io/schemas/1.31.0 metrics: - name: http_server_duration data: @@ -199,7 +195,7 @@ scope_metrics: - value: 1 ``` -Metrics which do not have an `otel_scope_name` or `otel_scope_version` label +Metrics which do not have any label with `otel_scope_` prefix MUST be assigned an instrumentation scope identifying the entity performing the translation from Prometheus to OpenTelemetry (e.g. the collector's prometheus receiver). @@ -280,19 +276,13 @@ It also dictates type-specific conversion rules listed below. ### Instrumentation Scope -Prometheus exporters SHOULD generate an [Info](https://github.com/prometheus/OpenMetrics/blob/v1.0.0/specification/OpenMetrics.md#info)-typed -metric named `otel_scope_info` for each Instrumentation Scope with non-empty -scope attributes. If present, Instrumentation Scope `name` and `version` MUST -be added as `otel_scope_name` and `otel_scope_version` labels. Scope attributes -MUST also be added as labels following the rules described in the -[`Metric Attributes`](#metric-attributes) section below. - -Prometheus exporters MUST add the scope name as the `otel_scope_name` label and -the scope version as the `otel_scope_version` label on all metric points by -default, based on the scope the original data point was nested in. - -Prometheus exporters SHOULD provide a configuration option to disable the -`otel_scope_info` metric and `otel_scope_` labels. +Prometheus exporters MUST by default add +the scope name as the `otel_scope_name` label, +the scope version as the `otel_scope_version` label, +the scope schema URL as the `otel_scope_schema_url` label, +the scope attributes as labels with `otel_scope_` prefix and following the rules +described in the [`Metric Attributes`](#metric-attributes) section below, +on all metric points, based on the scope the original data point was nested in. ### Gauges diff --git a/specification/metrics/sdk_exporters/prometheus.md b/specification/metrics/sdk_exporters/prometheus.md index d8f3f80dbb6..1fc1936b6eb 100644 --- a/specification/metrics/sdk_exporters/prometheus.md +++ b/specification/metrics/sdk_exporters/prometheus.md @@ -69,8 +69,8 @@ or UNIT metadata. The option MAY be named `without_units`, and MUST be `false` b A Prometheus Exporter MAY support a configuration option to produce metrics without a [type suffix](../../compatibility/prometheus_and_openmetrics.md#metric-metadata). The option MAY be named `without_type_suffix`, and MUST be `false` by default. -A Prometheus Exporter MAY support a configuration option to produce metrics without a [scope info](../../compatibility/prometheus_and_openmetrics.md#instrumentation-scope-1) -metric, or scope labels. The option MAY be named `without_scope_info`, and MUST be `false` by default. +A Prometheus Exporter MAY support a configuration option to produce metrics without [scope labels](../../compatibility/prometheus_and_openmetrics.md#instrumentation-scope-1). +The option MAY be named `without_scope_info`, and MUST be `false` by default. A Prometheus Exporter MAY support a configuration option to produce metrics without a [target info](../../compatibility/prometheus_and_openmetrics.md#resource-attributes-1) metric. The option MAY be named `without_target_info`, and MUST be `false` by default.