-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[resourcedetection] cpuinfo ignores the configured timeout in the resourcedetection processor #33771
Labels
bug
Something isn't working
os:windows
priority:p2
Medium
processor/resourcedetection
Resource detection processor
Comments
cwegener
added
bug
Something isn't working
needs triage
New item requiring triage
labels
Jun 26, 2024
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
github-actions
bot
added
the
processor/resourcedetection
Resource detection processor
label
Jun 26, 2024
Quick fix: diff --git a/processor/resourcedetectionprocessor/internal/system/system.go b/processor/resourcedetectionprocessor/internal/system/system.go
index f892087a48..54ace04266 100644
--- a/processor/resourcedetectionprocessor/internal/system/system.go
+++ b/processor/resourcedetectionprocessor/internal/system/system.go
@@ -130,7 +130,7 @@ func (d *Detector) Detect(ctx context.Context) (resource pcommon.Resource, schem
return pcommon.NewResource(), "", fmt.Errorf("failed getting OS description: %w", err)
}
- cpuInfo, err := cpu.Info()
+ cpuInfo, err := cpu.InfoWithContext(ctx)
if err != nil {
return pcommon.NewResource(), "", fmt.Errorf("failed getting host cpuinfo: %w", err)
} |
Forgot to mention that the default timeout value in Footnotes |
@cwegener Your fix looks reasonable to me, woluld you be open to file a PR to fix this? |
mx-psi
added
priority:p2
Medium
os:windows
and removed
needs triage
New item requiring triage
labels
Jun 26, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
os:windows
priority:p2
Medium
processor/resourcedetection
Resource detection processor
Component(s)
processor/resourcedetection, processor/resourcedetection/internal/system
What happened?
Description
The host cpuinfo attributes introduced in #26533 use the
cpu.Info()
call fromgopsutil
.cpu.Info()
ignores any timeouts that a user configures in the resourcedetection processor, as it is simply callingcpu.InfoWithContext(context.Background)
1Steps to Reproduce
N/A - A repro would require a really elaborate set up with a reliable way of slowing down COM calls in windows. Outside of production systems, I don't know how to artificially slow down COM calls ...
Expected Result
cpuinfo honors the configured timeout as configured by the user.
Actual Result
cpuinfo disregards the configured timeout as configured by the user.
Collector version
v0.103.1
Environment information
Environment
OS: Windows (10, 11, 2019, 2022)
OpenTelemetry Collector configuration
Log output
No response
Additional context
No response
Footnotes
https://github.com/shirou/gopsutil/blob/master/cpu/cpu_windows.go#L92-L94 ↩
The text was updated successfully, but these errors were encountered: