Skip to content

Commit 7c064b3

Browse files
ci(debugging): delete triggered probes in Django runs [backport 1.12] (#6046)
Backport 3452bb0 from #6026 to 1.12. In an attempt to speed up the Django runs with exploration tests on we delete probes that have been triggered so that future executions can happen with no overhead. --------- Co-authored-by: Gabriele N. Tornetta <[email protected]>
1 parent 6bb9f3b commit 7c064b3

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

.github/workflows/test_frameworks.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ jobs:
9696
DD_TESTING_RAISE: true
9797
DD_DEBUGGER_EXPL_ENCODE: 0 # Disabled to speed up
9898
DD_DEBUGGER_EXPL_PROFILER_ENABLED: ${{ matrix.expl_profiler }}
99+
DD_DEBUGGER_EXPL_PROFILER_DELETE_FUNCTION_PROBES: 1 # Delete to speed up
99100
DD_DEBUGGER_EXPL_COVERAGE_ENABLED: ${{ matrix.expl_coverage }}
101+
DD_DEBUGGER_EXPL_COVERAGE_DELETE_LINE_PROBES: 1 # Delete to speed up
100102
DD_DEBUGGER_EXPL_CONSERVATIVE: 1
101103
PYTHONPATH: ../ddtrace/tests/debugging/exploration/:.
102104
defaults:

tests/debugging/exploration/_config.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ class ProfilerConfig(En):
8282
default=True,
8383
help="Whether to enable the exploration deterministic profiler",
8484
)
85+
delete_probes = En.v(
86+
bool,
87+
"delete_function_probes",
88+
default=False,
89+
help="Whether to delete function probes after they are triggered",
90+
)
8591

8692
class CoverageConfig(En):
8793
__item__ = "coverage"

tests/debugging/exploration/_profiler.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from debugger import status
1010
from debugging.utils import create_snapshot_function_probe
1111

12+
from ddtrace.debugging._capture.snapshot import Snapshot
1213
from ddtrace.debugging._function.discovery import FunctionDiscovery
1314
from ddtrace.debugging._probe.model import FunctionLocationMixin
1415
from ddtrace.internal.module import origin
@@ -70,6 +71,12 @@ def on_disable(cls):
7071
# type: () -> None
7172
cls.report_func_calls()
7273

74+
@classmethod
75+
def on_snapshot(cls, snapshot):
76+
# type: (Snapshot) -> None
77+
if config.profiler.delete_probes:
78+
cls.delete_probe(snapshot.probe)
79+
7380

7481
if config.profiler.enabled:
7582
DeterministicProfiler.enable()

0 commit comments

Comments
 (0)