diff --git a/ddtrace/_monkey.py b/ddtrace/_monkey.py index fad8c8f4d2b..59b628da92f 100644 --- a/ddtrace/_monkey.py +++ b/ddtrace/_monkey.py @@ -8,15 +8,16 @@ from ddtrace.appsec import load_common_appsec_modules from ddtrace.internal.telemetry.constants import TELEMETRY_NAMESPACE from ddtrace.settings.asm import config as asm_config +from ddtrace.vendor.debtcollector import deprecate from .internal import telemetry from .internal.logger import get_logger from .internal.utils import formats +from .internal.utils.deprecations import DDTraceDeprecationWarning # noqa: E402 from .settings import _global_config as config if TYPE_CHECKING: # pragma: no cover - from typing import Any # noqa:F401 from typing import Callable # noqa:F401 from typing import List # noqa:F401 from typing import Union # noqa:F401 @@ -211,6 +212,16 @@ def on_import(hook): def patch_all(**patch_modules): + deprecate( + "patch_all is deprecated and will be removed in a future version of the tracer.", + message="""patch_all is deprecated in favor of ``import ddtrace.auto`` and ``DD_PATCH_MODULES`` + environment variable if needed.""", + category=DDTraceDeprecationWarning, + ) + _patch_all(**patch_modules) + + +def _patch_all(**patch_modules): # type: (bool) -> None """Enables ddtrace library instrumentation. @@ -221,7 +232,7 @@ def patch_all(**patch_modules): :param dict patch_modules: Override whether particular modules are patched or not. - >>> patch_all(redis=False, cassandra=False) + >>> _patch_all(redis=False, cassandra=False) """ modules = PATCH_MODULES.copy()