-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add
use_oneshot
parameter to speed up check runs with `psutil.Proce…
…ss().oneshot()` (#17817)
- Loading branch information
Showing
9 changed files
with
138 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add `use_oneshot` parameter to speed up check runs with `psutil.Process().oneshot()` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
|
||
[[envs.default.matrix]] | ||
python = ["2.7", "3.11"] | ||
|
||
[envs.bench] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# (C) Datadog, Inc. 2024-present | ||
# All rights reserved | ||
# Licensed under a 3-clause BSD style license (see LICENSE) | ||
from datadog_checks.process import ProcessCheck | ||
|
||
from . import common | ||
|
||
|
||
def test_run(benchmark, dd_run_check): | ||
instance = { | ||
'name': 'py', | ||
'search_string': ['python'], | ||
'exact_match': False, | ||
'ignored_denied_access': True, | ||
'use_oneshot': False, | ||
'thresholds': {'warning': [1, 10], 'critical': [1, 100]}, | ||
} | ||
process = ProcessCheck(common.CHECK_NAME, {}, [instance]) | ||
dd_run_check(process) | ||
|
||
benchmark(dd_run_check, process) | ||
|
||
|
||
def test_run_oneshot(benchmark, dd_run_check): | ||
instance = { | ||
'name': 'py', | ||
'search_string': ['python'], | ||
'exact_match': False, | ||
'ignored_denied_access': True, | ||
'use_oneshot': True, | ||
'thresholds': {'warning': [1, 10], 'critical': [1, 100]}, | ||
} | ||
process = ProcessCheck(common.CHECK_NAME, {}, [instance]) | ||
dd_run_check(process) | ||
|
||
benchmark(dd_run_check, process) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters