-
Notifications
You must be signed in to change notification settings - Fork 1.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
adding use_oneshot
parameter to speed up check runs with psutil.Process().oneshot()
#17817
Conversation
The |
The |
The |
The |
2 similar comments
The |
The |
Co-authored-by: Steven Yuen <steven.yuen@datadoghq.com>
Co-authored-by: Kyle Neale <kyle.neale@datadoghq.com>
What does this PR do?
This check adds a bool parameter
use_oneshot
that can be set to true so that the check usespsutil.Process().oneshot()
(https://psutil.readthedocs.io/en/latest/#psutil.Process.oneshot) to cache metrics and have a ~2x speed up of the check run.This defaults to
true
so that users are using the quicker/more efficient version of the check.Motivation
https://datadoghq.atlassian.net/browse/WINA-805
Additional Notes
From psutil docs: https://psutil.readthedocs.io/en/latest/#psutil.Process.oneshot
With this in mind we have set
use_oneshot
to be true by default since the check runs thepsutil.Process
methods often. So far this was tested through ddev on a Windows Laptop and a Linux container.Benchmark results:
Review checklist (to be filled by reviewers)
qa/skip-qa
label if the PR doesn't need to be tested during QA.backport/<branch-name>
label to the PR and it will automatically open a backport PR once this one is merged