Skip to content

Commit 8995916

Browse files
committed
initial find and replace along with integration docs mods
rn chore(iast): taint parameter name in post requests in fastapi (#12038) Continuation of #12009 - [x] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) - [x] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) still expose patch_all since it's just deprecated change imports for _patch_all clean up where it's called in strings fix up more tests
1 parent e294f47 commit 8995916

File tree

20 files changed

+55
-71
lines changed

20 files changed

+55
-71
lines changed

benchmarks/ddtrace_run/scenario.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def run(self):
2222

2323
# initialize subprocess args
2424
subp_cmd = []
25-
code = "import ddtrace; ddtrace.patch_all()\n"
25+
code = "import ddtrace; ddtrace._monkey._patch_all()\n"
2626
if self.ddtrace_run:
2727
subp_cmd = ["ddtrace-run"]
2828
code = ""

ddtrace/bootstrap/preload.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def _(_):
8787
LLMObs.enable()
8888

8989
if asbool(os.getenv("DD_TRACE_ENABLED", default=True)):
90-
from ddtrace import patch_all
90+
from ddtrace._monkey import _patch_all
9191

9292
@register_post_preload
9393
def _():
@@ -97,7 +97,7 @@ def _():
9797
modules_to_patch = os.getenv("DD_PATCH_MODULES")
9898
modules_to_str = parse_tags_str(modules_to_patch)
9999
modules_to_bool = {k: asbool(v) for k, v in modules_to_str.items()}
100-
patch_all(**modules_to_bool)
100+
_patch_all(**modules_to_bool)
101101

102102
if config._trace_methods:
103103
_install_trace_methods(config._trace_methods)

ddtrace/contrib/_aws_lambda.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
~~~~~~~~~~~~~~~~~~~~
1515
1616
This integration is configured automatically. The `datadog_lambda` package
17-
calls ``patch_all`` when ``DD_TRACE_ENABLED`` is set to ``true``.
17+
calls ``_patch_all`` when ``DD_TRACE_ENABLED`` is set to ``true``.
1818
It's not recommended to call ``patch`` for it manually. Since it would not do
1919
anything for other environments that do not meet the criteria above.
2020

ddtrace/contrib/_httplib.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,9 @@
88
99
The httplib integration is disabled by default. It can be enabled when using
1010
:ref:`ddtrace-run<ddtracerun>` or :ref:`import ddtrace.auto<ddtraceauto>`
11-
using the ``DD_TRACE_HTTPLIB_ENABLED`` environment variable::
11+
using the `DD_PATCH_MODULES` environment variable::
1212
13-
DD_TRACE_HTTPLIB_ENABLED=true ddtrace-run ....
14-
15-
The integration can also be enabled manually in code with
16-
:func:`patch_all()<ddtrace.patch_all>`::
17-
18-
from ddtrace import patch_all
19-
patch_all(httplib=True)
13+
DD_PATCH_MODULES=httplib:true ddtrace-run ....
2014
2115
2216
Global Configuration

ddtrace/contrib/_kombu.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Instrument kombu to report AMQP messaging.
22
3-
``patch_all`` will not automatically patch your Kombu client to make it work, as this would conflict with the
3+
ref:`import ddtrace.auto<ddtraceauto>` and `ddtrace-run` will not automatically patch your Kombu client to
4+
make it work, as this would conflict with the
45
Celery integration. You must specifically request kombu be patched, as in the example below.
56
67
Note: To permit distributed tracing for the kombu integration you must enable the tracer with priority
@@ -9,10 +10,9 @@
910
1011
Without enabling distributed tracing, spans within a trace generated by the kombu integration might be dropped
1112
without the whole trace being dropped.
12-
::
13-
14-
from ddtrace import patch
15-
from ddtrace.trace import Pin
13+
Run with `DD_PATCH_MODULES=kombu:true`::
14+
import ddtrace.auto
15+
from ddtrace import Pin
1616
import kombu
1717
1818
# If not patched yet, you can patch kombu specifically

ddtrace/contrib/_sanic.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
99
Sanic tracing can also be enabled explicitly::
1010
11-
from ddtrace import patch_all
12-
patch_all(sanic=True)
11+
import ddtrace.auto
1312
1413
from sanic import Sanic
1514
from sanic.response import text

ddtrace/contrib/_snowflake.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,7 @@
99
The integration is not enabled automatically when using
1010
:ref:`ddtrace-run<ddtracerun>` or :ref:`import ddtrace.auto<ddtraceauto>`.
1111
12-
Use ``DD_TRACE_SNOWFLAKE_ENABLED=true`` to enable it with ``ddtrace-run``
13-
14-
or :func:`patch()<ddtrace.patch>` to manually enable the integration::
15-
16-
from ddtrace import patch
17-
patch(snowflake=True)
18-
19-
or use :func:`patch_all()<ddtrace.patch_all>` to manually enable the integration::
20-
21-
from ddtrace import patch_all
22-
patch_all(snowflake=True)
23-
24-
12+
Use environment variable `DD_PATCH_MODULES:snowflake:true` to manually enable the integration::
2513
2614
2715
Global Configuration

ddtrace/contrib/_urllib3.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@
66
Enabling
77
~~~~~~~~
88
9-
The ``urllib3`` integration is not enabled by default. Use ``patch_all()``
10-
with the environment variable ``DD_TRACE_URLLIB3_ENABLED`` set, or call
11-
:func:`patch()<ddtrace.patch>` with the ``urllib3`` argument set to ``True`` to manually
12-
enable the integration, before importing and using ``urllib3``::
13-
14-
from ddtrace import patch
15-
patch(urllib3=True)
9+
The ``urllib3`` integration is not enabled by default. Use either ``ddtrace-run``
10+
or ``import ddtrace.auto`` with ``DD_PATCH_MODULES`` to enable it.
11+
``DD_PATCH_MODULES=urllib3 ddtrace-run python app.py`` or
12+
``DD_PATCH_MODULES=urllib3:true python app.py``::
1613
14+
import ddtrace.auto
1715
# use urllib3 like usual
1816
1917

ddtrace/contrib/internal/pytest/plugin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
DDTRACE_HELP_MSG = "Enable tracing of pytest functions."
3838
NO_DDTRACE_HELP_MSG = "Disable tracing of pytest functions."
3939
DDTRACE_INCLUDE_CLASS_HELP_MSG = "Prepend 'ClassName.' to names of class-based tests."
40-
PATCH_ALL_HELP_MSG = "Call ddtrace.patch_all before running tests."
40+
PATCH_ALL_HELP_MSG = "Call ddtrace._patch_all before running tests."
4141

4242

4343
def is_enabled(config):
@@ -172,7 +172,7 @@ def patch_all(request):
172172
"""Patch all available modules for Datadog tracing when ddtrace-patch-all
173173
is specified in command or .ini.
174174
"""
175-
import ddtrace
176-
177175
if request.config.getoption("ddtrace-patch-all") or request.config.getini("ddtrace-patch-all"):
178-
ddtrace.patch_all()
176+
from ddtrace._monkey import _patch_all
177+
178+
_patch_all()

docs/api.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ Tracing
99
1010
.. automodule:: ddtrace.auto
1111

12-
.. autofunction:: ddtrace.patch_all
13-
1412
.. autofunction:: ddtrace.patch
1513

1614
.. autoclass:: ddtrace.trace.Tracer

0 commit comments

Comments
 (0)