Skip to content

Commit fc9f595

Browse files
crobert-1vincentfree
authored andcommitted
[receiver/prometheus] Upgrade receiver.prometheus.removeLegacyResourceAttributes feature flag (open-telemetry#39803)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description This feature flag was introduced in open-telemetry#32829 to resolve open-telemetry#32814. It was first released in `v0.103.0`, on June 19, 2024 which was 10 months ago. The feature gate is to remove deprecated resource attributes in favor of the semantic convention equivalents. This is a breaking change and the feature flag will now be enabled by default. <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue open-telemetry#32814 <!--Describe what testing was performed and which tests were added.--> #### Testing Updated testing to account for the feature flag being enabled by default.
1 parent c0a57b1 commit fc9f595

File tree

4 files changed

+34
-6
lines changed

4 files changed

+34
-6
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# 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: breaking
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
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: Upgrade `receiver.prometheusreceiver.RemoveLegacyResourceAttributes` feature gate to `beta` stability (enabled by default)
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: [32814]
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+
Disable the `receiver.promtheusreceiver.RemoveLegacyResourceAttributes` feature gate to restore previous behavior. This feature gate will be removed in a future release.
20+
The feature gate is used to replace the following legacy resource attributes:
21+
`net.host.name` -> `server.address`
22+
`net.host.port` -> `server.port`
23+
`http.scheme` -> `url.scheme`
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.
31+
# Default: '[user]'
32+
change_logs: []

exporter/prometheusexporter/end_to_end_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func TestEndToEndSummarySupport(t *testing.T) {
144144
`test_up.instance="127.0.0.1:.*",job="otel-collector". 1 .*`,
145145
`. HELP test_target_info Target metadata`,
146146
`. TYPE test_target_info gauge`,
147-
`test_target_info.http_scheme=\"http\",instance="127.0.0.1:.*",job="otel-collector",net_host_port=".*,server_port=".*",url_scheme="http". 1`,
147+
`test_target_info.instance="127.0.0.1:.*",job="otel-collector",server_port=".*",url_scheme="http". 1`,
148148
}
149149

150150
// 5.5: Perform a complete line by line prefix verification to ensure we extract back the inputs

receiver/prometheusreceiver/internal/prom_to_otlp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const removeOldSemconvFeatureGateID = "receiver.prometheusreceiver.RemoveLegacyR
1818

1919
var removeOldSemconvFeatureGate = featuregate.GlobalRegistry().MustRegister(
2020
removeOldSemconvFeatureGateID,
21-
featuregate.StageAlpha,
21+
featuregate.StageBeta,
2222
featuregate.WithRegisterFromVersion("v0.101.0"),
2323
featuregate.WithRegisterDescription("When enabled, the net.host.name, net.host.port, and http.scheme resource attributes are no longer added to metrics. Use server.address, server.port, and url.scheme instead."),
2424
featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/32814"),

receiver/prometheusreceiver/metrics_receiver_labels_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -628,9 +628,7 @@ func verifyHonorLabelsTrue(t *testing.T, td *testData, rms []pmetric.ResourceMet
628628
expectedResourceAttributes.PutStr("service.name", "honor_labels_test")
629629
expectedResourceAttributes.PutStr("service.instance.id", "hostname:8080")
630630
expectedResourceAttributes.PutStr("server.port", "8080")
631-
expectedResourceAttributes.PutStr("net.host.port", "8080")
632631
expectedResourceAttributes.PutStr("server.address", "hostname")
633-
expectedResourceAttributes.PutStr("net.host.name", "hostname")
634632

635633
expectedScrapeConfigAttributes := td.attributes
636634

@@ -748,9 +746,7 @@ func verifyRelabelJobInstance(t *testing.T, td *testData, rms []pmetric.Resource
748746
wantAttributes.PutStr("service.name", "not-target1")
749747
wantAttributes.PutStr("service.instance.id", "relabeled-instance")
750748
wantAttributes.PutStr("server.port", "")
751-
wantAttributes.PutStr("net.host.port", "")
752749
wantAttributes.PutStr("server.address", "relabeled-instance")
753-
wantAttributes.PutStr("net.host.name", "relabeled-instance")
754750

755751
metrics1 := rms[0].ScopeMetrics().At(0).Metrics()
756752
ts1 := metrics1.At(0).Gauge().DataPoints().At(0).Timestamp()

0 commit comments

Comments
 (0)