Skip to content

Commit 73747ae

Browse files
authored
[processor/resourcedetection] Graduate processor.resourcedetection.hostCPUModelAndFamilyAsString to beta (#29462)
**Description:** Follow up to #29152. The feature gate has been in alpha for two releases (v0.89.0 and v0.90.0). **Link to tracking Issue:** Relates to #29025 and to open-telemetry/semantic-conventions/issues/495. **Testing:** Tested with the sample configuration on #26533.
1 parent 529fb91 commit 73747ae

File tree

2 files changed

+35
-7
lines changed

2 files changed

+35
-7
lines changed

.chloggen/mx-psi_rdp-fg.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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: bug_fix
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: resourcedetectionprocessor
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Change type of `host.cpu.model.id` and `host.cpu.model.family` from int to string.
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: [29025]
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 `processor.resourcedetection.hostCPUModelAndFamilyAsString` feature gate to get the old behavior.
20+
21+
# If your change doesn't affect end users or the exported elements of any package,
22+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
23+
# Optional: The change log or logs in which this entry should be included.
24+
# e.g. '[user]' or '[user, api]'
25+
# Include 'user' if the change is relevant to end users.
26+
# Include 'api' if there is a change to a library API.
27+
# Default: '[user]'
28+
change_logs: []

processor/resourcedetectionprocessor/internal/system/system.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var (
2525
hostCPUModelAndFamilyAsStringID = "processor.resourcedetection.hostCPUModelAndFamilyAsString"
2626
hostCPUModelAndFamilyAsStringFeatureGate = featuregate.GlobalRegistry().MustRegister(
2727
hostCPUModelAndFamilyAsStringID,
28-
featuregate.StageAlpha,
28+
featuregate.StageBeta,
2929
featuregate.WithRegisterDescription("Change type of host.cpu.model.id and host.cpu.model.family to string."),
3030
featuregate.WithRegisterFromVersion("v0.89.0"),
3131
featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/semantic-conventions/issues/495"),
@@ -160,13 +160,13 @@ func setHostCPUInfo(d *Detector, cpuInfo cpu.InfoStat) error {
160160
d.logger.Debug("getting host's cpuinfo", zap.String("coreID", cpuInfo.CoreID))
161161
d.rb.SetHostCPUVendorID(cpuInfo.VendorID)
162162
if hostCPUModelAndFamilyAsStringFeatureGate.IsEnabled() {
163-
d.rb.SetHostCPUFamily(cpuInfo.Family)
164-
} else {
165163
// https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/29025
166-
d.logger.Warn("This attribute will change from int to string. Switch now using the feature gate.",
164+
d.logger.Info("This attribute changed from int to string. Temporarily switch back to int using the feature gate.",
167165
zap.String("attribute", "host.cpu.family"),
168166
zap.String("feature gate", hostCPUModelAndFamilyAsStringID),
169167
)
168+
d.rb.SetHostCPUFamily(cpuInfo.Family)
169+
} else {
170170
family, err := strconv.ParseInt(cpuInfo.Family, 10, 64)
171171
if err != nil {
172172
return fmt.Errorf("failed to convert cpuinfo family to integer: %w", err)
@@ -179,13 +179,13 @@ func setHostCPUInfo(d *Detector, cpuInfo cpu.InfoStat) error {
179179
// ISSUE: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/27675
180180
if cpuInfo.Model != "" {
181181
if hostCPUModelAndFamilyAsStringFeatureGate.IsEnabled() {
182-
d.rb.SetHostCPUModelID(cpuInfo.Model)
183-
} else {
184182
// https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/29025
185-
d.logger.Warn("This attribute will change from int to string. Switch now using the feature gate.",
183+
d.logger.Info("This attribute changed from int to string. Temporarily switch back to int using the feature gate.",
186184
zap.String("attribute", "host.cpu.model.id"),
187185
zap.String("feature gate", hostCPUModelAndFamilyAsStringID),
188186
)
187+
d.rb.SetHostCPUModelID(cpuInfo.Model)
188+
} else {
189189
model, err := strconv.ParseInt(cpuInfo.Model, 10, 64)
190190
if err != nil {
191191
return fmt.Errorf("failed to convert cpuinfo model to integer: %w", err)

0 commit comments

Comments
 (0)