Skip to content

Commit aa32be7

Browse files
authored
test(profiling): import and patching order (#7886)
We fix the import and patching order in the simple gevent program script to match what a user is supposed to do to correctly initialise the library when using the programmatic API. ## Checklist - [ ] Change(s) are motivated and described in the PR description. - [ ] Testing strategy is described if automated tests are not included in the PR. - [ ] Risk is outlined (performance impact, potential for breakage, maintainability, etc). - [ ] Change is maintainable (easy to change, telemetry, documentation). - [ ] [Library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) are followed. If no release note is required, add label `changelog/no-changelog`. - [ ] Documentation is included (in-code, generated user docs, [public corp docs](https://github.com/DataDog/documentation/)). - [ ] Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Title is accurate. - [x] No unnecessary changes are introduced. - [x] Description motivates each change. - [x] Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes unless absolutely necessary. - [x] Testing strategy adequately addresses listed risk(s). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] Release note makes sense to a user of the library. - [x] Reviewer has explicitly acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment. - [x] Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) - [x] If this PR touches code that signs or publishes builds or packages, or handles credentials of any kind, I've requested a review from `@DataDog/security-design-and-guidance`. - [x] This PR doesn't touch any of that.
1 parent 8bf0dc9 commit aa32be7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tests/profiling/simple_program_gevent.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
from gevent import monkey
2-
31
# Import from ddtrace before monkey patching to ensure that we grab all the
42
# necessary references to the unpatched modules.
5-
from ddtrace.profiling import bootstrap
3+
import ddtrace.auto # noqa: F401
64
import ddtrace.profiling.auto # noqa:F401
5+
6+
from ddtrace.profiling import bootstrap
77
from ddtrace.profiling.collector import stack_event
88

99

10-
monkey.patch_all()
10+
import gevent.monkey
11+
12+
gevent.monkey.patch_all()
1113

1214
import threading
1315
import time

0 commit comments

Comments
 (0)