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
[receiver/prometheus] Generate Scope Attributes from otel_scope_<attribute-name> labels (#46612)
#### Description
Add support for extracting scope attributes from
otel_scope_<attribute-name> labels on metrics in the Prometheus
receiver, per the spec change.
This is gated behind
`receiver.prometheusreceiver.UseScopeAttributeLabels` (alpha, disabled
by default). The gate acts as a switch:
* Disabled (default): existing behavior — scope attributes come from
otel_scope_info, and otel_scope_<attr> labels are treated as regular
data point attributes.
* Enabled: scope attributes are read from otel_scope_<attr> labels on
every metric, otel_scope_info is ignored.
#### Link to tracking issue
Fixes#41502
#### Testing
* Added integration tests (TestScopeAttributeLabelsFeatureGate) covering
both gate states: enabled extracts scope attributes and splits scopes;
disabled preserves otel_scope_* as regular labels.
* Existing TestScopeInfoScopeAttributes and all internal tests pass
unchanged.
---------
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
# Use this changelog template to create an entry for release notes.
2
+
3
+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4
+
change_type: enhancement
5
+
6
+
# The name of the component, or a single word describing the area of concern, (e.g. receiver/filelog)
7
+
component: receiver/prometheus
8
+
9
+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10
+
note: Add support for reading instrumentation scope attributes from `otel_scope_<attribute-name>` labels while feature-gating deprecation of `otel_scope_info`.
11
+
12
+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13
+
issues: [41502]
14
+
15
+
# (Optional) One or more lines of additional information to render under the primary note.
16
+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17
+
# Use pipe (|) for multiline entries.
18
+
subtext: |
19
+
Scope attributes are always extracted from `otel_scope_<attribute-name>` labels on metrics.
20
+
The `receiver.prometheusreceiver.IgnoreScopeInfoMetric` feature gate (alpha, disabled by default)
21
+
controls only whether the legacy `otel_scope_info` metric is ignored for scope attribute extraction.
22
+
When the gate is disabled, both mechanisms coexist to support migration.
23
+
See the specification change for motivation: https://github.com/open-telemetry/opentelemetry-specification/pull/4505
24
+
25
+
# If your change doesn't affect end users or the exported elements of any package,
26
+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
27
+
# Optional: The change log or logs in which this entry should be included.
28
+
# e.g. '[user]' or '[user, api]'
29
+
# Include 'user' if the change is relevant to end users.
30
+
# Include 'api' if there is a change to a library API.
|`receiver.prometheusreceiver.EnableCreatedTimestampZeroIngestion`| alpha | Enables the Prometheus created-timestamps-zero-injection feature. Created timestamps are injected as 0-valued samples when appropriate. This is disabled by default due to worse CPU performance with higher metric volumes. | v0.113.0 | N/A |[Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/40355)|
12
12
|`receiver.prometheusreceiver.EnableNativeHistograms`| stable | Converts scraped Prometheus native histograms into OpenTelemetry exponential histograms. You still need to configure 'scrape_native_histograms: true' in your Prometheus scrape config to actually scrape native histograms. For mixed histograms (both classic and native), only the native histogram buckets are used. | v0.142.0 | v0.145.0 |[Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/34473)|
13
+
|`receiver.prometheusreceiver.IgnoreScopeInfoMetric`| alpha | When enabled, the `otel_scope_info` metric is ignored for scope attribute extraction. | v0.148.0 | N/A |[Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/41502)|
13
14
|`receiver.prometheusreceiver.RemoveStartTimeAdjustment`| stable | When enabled, the Prometheus receiver will leave the start time unset. Use the metric_start_time processor instead if you need this functionality. | v0.121.0 | v0.142.0 |[Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/36364)|
14
15
|`receiver.prometheusreceiver.UseCreatedMetric`| deprecated | When enabled, the Prometheus receiver will retrieve the start time for Summary, Histogram and Sum metrics from _created metric. | v0.89.0 | v0.141.0 |[Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/21909)|
0 commit comments