From 7021c961cf0050f3c2138a0e46c0bb3d42eca995 Mon Sep 17 00:00:00 2001 From: "Gabriele N. Tornetta" Date: Fri, 9 Sep 2022 15:09:14 +0100 Subject: [PATCH] chore(debugging): fix exploration debugger import With the recent refactor that enabled RCM for the debugger, the content of the old probe poller module has been moved in the probe remoteconfig one. This change fixes an import that was still referecing the removed module and prevented the exploration debuggers from running. A test has also been added to catch potential issues with the exploration debuggers in the future. --- tests/debugging/exploration/debugger.py | 8 +-- tests/debugging/exploration/test_bootstrap.py | 52 +++++++++++++++++++ 2 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 tests/debugging/exploration/test_bootstrap.py diff --git a/tests/debugging/exploration/debugger.py b/tests/debugging/exploration/debugger.py index ce1c63667f7..7185acd82a4 100644 --- a/tests/debugging/exploration/debugger.py +++ b/tests/debugging/exploration/debugger.py @@ -13,7 +13,7 @@ from ddtrace.debugging._function.discovery import FunctionDiscovery from ddtrace.debugging._probe.model import ConditionalProbe from ddtrace.debugging._probe.model import Probe -from ddtrace.debugging._probe.poller import ProbePollerEvent +from ddtrace.debugging._probe.remoteconfig import ProbePollerEvent from ddtrace.debugging._snapshot.collector import SnapshotCollector from ddtrace.debugging._snapshot.collector import SnapshotContext from ddtrace.debugging._snapshot.model import Snapshot @@ -232,17 +232,17 @@ def get_triggered_probes(cls): @classmethod def add_probe(cls, probe): # type: (Probe) -> None - cls._instance._on_poller_event(ProbePollerEvent.NEW_PROBES, [probe]) + cls._instance._on_configuration(ProbePollerEvent.NEW_PROBES, [probe]) @classmethod def add_probes(cls, probes): # type: (t.List[Probe]) -> None - cls._instance._on_poller_event(ProbePollerEvent.NEW_PROBES, probes) + cls._instance._on_configuration(ProbePollerEvent.NEW_PROBES, probes) @classmethod def delete_probe(cls, probe): # type: (Probe) -> None - cls._instance._on_poller_event(ProbePollerEvent.DELETED_PROBES, [probe]) + cls._instance._on_configuration(ProbePollerEvent.DELETED_PROBES, [probe]) if asbool(os.getenv("DD_DEBUGGER_EXPL_STATUS_MESSAGES", False)): diff --git a/tests/debugging/exploration/test_bootstrap.py b/tests/debugging/exploration/test_bootstrap.py new file mode 100644 index 00000000000..67ac04bcf65 --- /dev/null +++ b/tests/debugging/exploration/test_bootstrap.py @@ -0,0 +1,52 @@ +from os.path import dirname + +import pytest + +from ddtrace.internal.compat import PY2 + + +if PY2: + OUT = """Enabling debugging exploration testing +========================== LineCoverage: probes stats ========================== + +Installed probes: 0/0 + +================================ Line coverage ================================= + +Source Lines Covered +========================================================================== +No lines found +===================== DeterministicProfiler: probes stats ====================== + +Installed probes: 0/0 + +============================== Function coverage =============================== + +No functions called +""" +else: + OUT = """Enabling debugging exploration testing +===================== DeterministicProfiler: probes stats ====================== + +Installed probes: 0/0 + +============================== Function coverage =============================== + +No functions called +========================== LineCoverage: probes stats ========================== + +Installed probes: 0/0 + +================================ Line coverage ================================= + +Source Lines Covered +========================================================================== +No lines found +""" + + +@pytest.mark.subprocess(env={"PYTHONPATH": dirname(__file__)}, out=OUT) +def test_exploration_bootstrap(): + # We test that we get the expected output from the exploration debuggers + # and no errors when running the sitecustomize.py script. + pass