Skip to content

Commit 0d91f94

Browse files
committed
disable dynamic instrumentation
1 parent 11e7a5f commit 0d91f94

File tree

11 files changed

+103
-3
lines changed

11 files changed

+103
-3
lines changed

.riot/requirements/13a3198.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.12
3+
# by the following command:
4+
#
5+
# pip-compile --no-annotate .riot/requirements/13a3198.in
6+
#
7+
attrs==23.1.0
8+
coverage[toml]==7.3.0
9+
hypothesis==6.45.0
10+
iniconfig==2.0.0
11+
mock==5.1.0
12+
msgpack==1.0.5
13+
opentracing==2.4.0
14+
packaging==23.1
15+
pluggy==1.3.0
16+
pytest==7.4.0
17+
pytest-cov==4.1.0
18+
pytest-mock==3.11.1
19+
sortedcontainers==2.4.0

.riot/requirements/1540a76.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.12
3+
# by the following command:
4+
#
5+
# pip-compile --no-annotate .riot/requirements/1540a76.in
6+
#
7+
attrs==23.1.0
8+
coverage[toml]==7.3.0
9+
httpretty==1.1.4
10+
hypothesis==6.45.0
11+
iniconfig==2.0.0
12+
mock==5.1.0
13+
msgpack==1.0.5
14+
opentracing==2.4.0
15+
packaging==23.1
16+
pluggy==1.3.0
17+
pytest==7.4.0
18+
pytest-asyncio==0.21.1
19+
pytest-cov==4.1.0
20+
pytest-mock==3.11.1
21+
sortedcontainers==2.4.0
22+
typing-extensions==4.7.1

.riot/requirements/19535a2.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.12
3+
# by the following command:
4+
#
5+
# pip-compile --no-annotate .riot/requirements/19535a2.in
6+
#
7+
attrs==23.1.0
8+
coverage[toml]==7.3.0
9+
hypothesis==6.45.0
10+
iniconfig==2.0.0
11+
mock==5.1.0
12+
opentracing==2.4.0
13+
packaging==23.1
14+
pluggy==1.3.0
15+
pytest==7.4.0
16+
pytest-cov==4.1.0
17+
pytest-mock==3.11.1
18+
sortedcontainers==2.4.0

ddtrace/bootstrap/sitecustomize.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,13 @@ def _(threading):
161161
import ddtrace.profiling.auto # noqa: F401
162162

163163
if di_config.enabled or ed_config.enabled:
164-
from ddtrace.debugging import DynamicInstrumentation
164+
# FIXME[python-3.12]: blocked on bytecode release https://github.com/MatthieuDartiailh/bytecode/pull/122
165+
if not sys.version_info >= (3, 12):
166+
from ddtrace.debugging import DynamicInstrumentation
165167

166-
DynamicInstrumentation.enable()
168+
DynamicInstrumentation.enable()
169+
else:
170+
log.warning("Dynamic Instrumentation is not supported with Python 3.12 and cannot be enabled.")
167171

168172
if config._runtime_metrics_enabled:
169173
RuntimeWorker.enable()

ddtrace/debugging/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
1818
# Disable the debugger
1919
DynamicInstrumentation.disable()
20+
21+
.. note::
22+
Dynamic Instrumentation is not supported with Python 3.12.
23+
2024
"""
2125

2226
from ddtrace.debugging._debugger import Debugger as DynamicInstrumentation

riotfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ def select_pys(min_version=MIN_PYTHON_VERSION, max_version=MAX_PYTHON_VERSION):
350350
"pytest-asyncio": latest,
351351
},
352352
# FIXME[python-3.12]: blocked on bytecode release https://github.com/MatthieuDartiailh/bytecode/pull/122
353-
pys=select_pys(min_version="3.7", max_version="3.11"),
353+
pys=select_pys(min_version="3.7", max_version="3.12"),
354354
),
355355
Venv(
356356
name="vendor",

tests/debugging/function/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import sys
2+
3+
import pytest
4+
5+
6+
if sys.version_info[:2] == (3, 12):
7+
pytest.skip("Dynamic instrumentation is not supported with Python 3.12", allow_module_level=True)

tests/debugging/test_api.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
1+
import sys
2+
13
import pytest
24

35

6+
@pytest.mark.skipif(sys.version_info >= (3, 12), reason="Dynamic Instrumentation is not supported with Python 3.11")
47
@pytest.mark.subprocess(ddtrace_run=True, env=dict(DD_DYNAMIC_INSTRUMENTATION_ENABLED="true"), err=None)
58
def test_debugger_enabled_ddtrace_run():
69
from ddtrace.debugging import DynamicInstrumentation
710

811
assert DynamicInstrumentation._instance is not None
912

1013

14+
@pytest.mark.skipif(sys.version_info < (3, 12), reason="Dynamic Instrumentation disabled for Python 3.12")
15+
@pytest.mark.subprocess(ddtrace_run=True, env=dict(DD_DYNAMIC_INSTRUMENTATION_ENABLED="true"), err=None)
16+
def test_debugger_enabled_ddtrace_run_py312():
17+
from ddtrace.debugging import DynamicInstrumentation
18+
19+
assert DynamicInstrumentation._instance is None
20+
21+
1122
@pytest.mark.subprocess(ddtrace_run=True, err=None)
1223
def test_debugger_disabled_ddtrace_run():
1324
from ddtrace.debugging import DynamicInstrumentation

tests/debugging/test_debugger.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
from tests.utils import call_program
3333

3434

35+
if sys.version_info[:2] == (3, 12):
36+
pytest.skip("Dynamic instrumentation is not supported with Python 3.12", allow_module_level=True)
37+
38+
3539
def good_probe():
3640
# DEV: We build this on demand to ensure that rate limiting gets reset.
3741
return create_snapshot_line_probe(

tests/debugging/test_debugger_span_decoration.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# -*- encoding: utf-8 -*-
22
import sys
33

4+
import pytest
5+
46
import ddtrace
57
from ddtrace.debugging._probe.model import ProbeEvaluateTimingForMethod
68
from ddtrace.debugging._probe.model import SpanDecoration
@@ -16,6 +18,10 @@
1618
from tests.utils import TracerTestCase
1719

1820

21+
if sys.version_info[:2] == (3, 12):
22+
pytest.skip("Dynamic instrumentation is not supported with Python 3.12", allow_module_level=True)
23+
24+
1925
class SpanDecorationProbeTestCase(TracerTestCase):
2026
def setUp(self):
2127
super(SpanDecorationProbeTestCase, self).setUp()

tests/debugging/test_expressions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
from dis import dis
2+
import sys
23

34
import pytest
45

56
from ddtrace.debugging._expressions import dd_compile
67
from ddtrace.internal.safety import SafeObjectProxy
78

89

10+
if sys.version_info[:2] == (3, 12):
11+
pytest.skip("Dynamic instrumentation is not supported with Python 3.12", allow_module_level=True)
12+
13+
914
class SideEffect(Exception):
1015
pass
1116

0 commit comments

Comments
 (0)