-
Notifications
You must be signed in to change notification settings - Fork 416
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into zachg/handle_cross_org_propagation
- Loading branch information
Showing
11 changed files
with
850 additions
and
47 deletions.
There are no files selected for viewing
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env python | ||
import os | ||
import sys | ||
import time | ||
|
||
from ddtrace.internal import service | ||
from ddtrace.profiling import bootstrap | ||
from ddtrace.profiling.collector import stack | ||
|
||
|
||
for running_collector in bootstrap.profiler._profiler._collectors: | ||
if isinstance(running_collector, stack.StackCollector): | ||
break | ||
else: | ||
raise AssertionError("Unable to find stack collector") | ||
|
||
|
||
print("hello world") | ||
assert running_collector.status == service.ServiceStatus.RUNNING | ||
print(running_collector.interval) | ||
|
||
t0 = time.time() | ||
while time.time() - t0 < (running_collector.interval * 10): | ||
pass | ||
|
||
# Do some serious memory allocations! | ||
for _ in range(5000000): | ||
object() | ||
|
||
print(os.getpid()) | ||
print(bootstrap.profiler._profiler._stack_v2_enabled) | ||
sys.exit(42) |
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,32 @@ | ||
import os | ||
import sys | ||
import threading | ||
|
||
from ddtrace.internal import service | ||
import ddtrace.profiling.auto | ||
import ddtrace.profiling.bootstrap | ||
import ddtrace.profiling.profiler | ||
|
||
|
||
lock = threading.Lock() | ||
lock.acquire() | ||
|
||
|
||
assert ddtrace.profiling.bootstrap.profiler.status == service.ServiceStatus.RUNNING | ||
|
||
|
||
child_pid = os.fork() | ||
if child_pid == 0: | ||
# Release it | ||
lock.release() | ||
|
||
# We track this one though | ||
lock = threading.Lock() | ||
lock.acquire() | ||
lock.release() | ||
else: | ||
lock.release() | ||
assert ddtrace.profiling.bootstrap.profiler.status == service.ServiceStatus.RUNNING | ||
print(child_pid) | ||
pid, status = os.waitpid(child_pid, 0) | ||
sys.exit(os.WEXITSTATUS(status)) |
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,34 @@ | ||
# Import from ddtrace before monkey patching to ensure that we grab all the | ||
# necessary references to the unpatched modules. | ||
import ddtrace.auto # noqa: F401, I001 | ||
import ddtrace.profiling.auto # noqa:F401 | ||
|
||
|
||
import gevent.monkey # noqa:F402 | ||
|
||
gevent.monkey.patch_all() | ||
|
||
import threading # noqa: E402, F402, I001 | ||
import time # noqa: E402, F402 | ||
|
||
|
||
def fibonacci(n): | ||
if n == 0: | ||
return 0 | ||
elif n == 1: | ||
return 1 | ||
else: | ||
return fibonacci(n - 1) + fibonacci(n - 2) | ||
|
||
|
||
i = 1 | ||
for _ in range(20): | ||
threads = [] | ||
for _ in range(10): | ||
t = threading.Thread(target=fibonacci, args=(i,)) | ||
t.start() | ||
threads.append(t) | ||
i += 1 | ||
for t in threads: | ||
t.join() | ||
time.sleep(0.1) |
Oops, something went wrong.