8
8
from ddtrace .appsec import load_common_appsec_modules
9
9
from ddtrace .internal .telemetry .constants import TELEMETRY_NAMESPACE
10
10
from ddtrace .settings .asm import config as asm_config
11
+ from ddtrace .vendor .debtcollector import deprecate
11
12
12
13
from .internal import telemetry
13
14
from .internal .logger import get_logger
14
15
from .internal .utils import formats
16
+ from .internal .utils .deprecations import DDTraceDeprecationWarning # noqa: E402
15
17
from .settings import _global_config as config
16
18
17
19
18
20
if TYPE_CHECKING : # pragma: no cover
19
- from typing import Any # noqa:F401
20
21
from typing import Callable # noqa:F401
21
22
from typing import List # noqa:F401
22
23
from typing import Union # noqa:F401
@@ -211,6 +212,16 @@ def on_import(hook):
211
212
212
213
213
214
def patch_all (** patch_modules ):
215
+ deprecate (
216
+ "patch_all is deprecated and will be removed in a future version of the tracer." ,
217
+ message = """patch_all is deprecated in favor of ``import ddtrace.auto`` and ``DD_PATCH_MODULES``
218
+ environment variable if needed.""" ,
219
+ category = DDTraceDeprecationWarning ,
220
+ )
221
+ _patch_all (** patch_modules )
222
+
223
+
224
+ def _patch_all (** patch_modules ):
214
225
# type: (bool) -> None
215
226
"""Enables ddtrace library instrumentation.
216
227
@@ -221,7 +232,7 @@ def patch_all(**patch_modules):
221
232
222
233
:param dict patch_modules: Override whether particular modules are patched or not.
223
234
224
- >>> patch_all (redis=False, cassandra=False)
235
+ >>> _patch_all (redis=False, cassandra=False)
225
236
"""
226
237
modules = PATCH_MODULES .copy ()
227
238
0 commit comments