Skip to content

Commit 8feda79

Browse files
authored
[receiver/hostmetrics] Mark hostmetrics.process.onWindowsUseNewGetProcesses feature gate as stable (#40420)
#### Description Mark `hostmetrics.process.onWindowsUseNewGetProcesses` feature gate as stable #### Link to tracking issue Follow-up to PR #38589
1 parent f3b232c commit 8feda79

File tree

3 files changed

+31
-86
lines changed

3 files changed

+31
-86
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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: deprecation
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: receiver/hostmetrics
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Mark `hostmetrics.process.onWindowsUseNewGetProcesses` feature gate as stable
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: [32947]
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+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: [user]

receiver/hostmetricsreceiver/internal/scraper/processscraper/get_process_handles_windows.go

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,15 @@ import (
1515
"golang.org/x/sys/windows"
1616
)
1717

18-
var useNewGetProcessHandles = featuregate.GlobalRegistry().MustRegister(
18+
var _ = featuregate.GlobalRegistry().MustRegister(
1919
"hostmetrics.process.onWindowsUseNewGetProcesses",
20-
featuregate.StageBeta,
20+
featuregate.StageStable,
2121
featuregate.WithRegisterDescription("If disabled, the scraper will use the legacy implementation to retrieve process handles."),
22+
featuregate.WithRegisterFromVersion("v0.123.0"),
23+
featuregate.WithRegisterToVersion("v0.127.0"),
2224
)
2325

2426
func getGopsutilProcessHandles(ctx context.Context) (processHandles, error) {
25-
if !useNewGetProcessHandles.IsEnabled() {
26-
return getGopsutilProcessHandlesLegacy(ctx)
27-
}
28-
2927
snap, err := windows.CreateToolhelp32Snapshot(windows.TH32CS_SNAPPROCESS, 0)
3028
if err != nil {
3129
return nil, fmt.Errorf("could not create snapshot: %w", err)
@@ -67,18 +65,3 @@ func getGopsutilProcessHandles(ctx context.Context) (processHandles, error) {
6765

6866
return &gopsProcessHandles{handles: wrappedProcesses}, nil
6967
}
70-
71-
func getGopsutilProcessHandlesLegacy(ctx context.Context) (processHandles, error) {
72-
processes, err := process.ProcessesWithContext(ctx)
73-
if err != nil {
74-
return nil, err
75-
}
76-
wrapped := make([]wrappedProcessHandle, len(processes))
77-
for i, p := range processes {
78-
wrapped[i] = wrappedProcessHandle{
79-
Process: p,
80-
}
81-
}
82-
83-
return &gopsProcessHandles{handles: wrapped}, nil
84-
}

receiver/hostmetricsreceiver/internal/scraper/processscraper/process_metadata_benchmark_test.go

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)