Skip to content

Commit d0b151a

Browse files
mabdinurP403n1x87emmettbutler
authored
docs(tracing): remove patch_all from basic usage docs [3.0] (#11868)
Resolves: #11865 - Removes documentation for `ddtrace.patch_all(...)` from basic usage. We should encourage the use of `ddtrace.auto` instead. - For fine grained control over enabling/disabling integrations `DD_PATCH_MODULES` and `DD_TRACE_<Integration>_ENABLED` should be used. ## Checklist - [ ] 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)) ## Reviewer Checklist - [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) --------- Co-authored-by: Gabriele N. Tornetta <[email protected]> Co-authored-by: Emmett Butler <[email protected]>
1 parent a58f139 commit d0b151a

File tree

4 files changed

+8
-46
lines changed

4 files changed

+8
-46
lines changed

ddtrace/_monkey.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def on_import(hook):
206206

207207
def patch_all(**patch_modules):
208208
# type: (bool) -> None
209-
"""Automatically patches all available modules.
209+
"""Enables ddtrace library instrumentation.
210210
211211
In addition to ``patch_modules``, an override can be specified via an
212212
environment variable, ``DD_TRACE_<module>_ENABLED`` for each module.

docs/basic_usage.rst

+6-26
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,19 @@
33
Basic Usage
44
===========
55

6-
Tracing
7-
~~~~~~~
6+
Automatic Instrumentation
7+
~~~~~~~~~~~~~~~~~~~~~~~~~
88

99
``ddtrace.auto``
1010
----------------
1111

12-
To set up instrumentation within your application, call :ref:`import ddtrace.auto<ddtraceauto>` as early as possible
12+
To enable full ddtrace support (library instrumentation, profiling, application security monitoring, dynamic instrumentation, etc.) call :ref:`import ddtrace.auto<ddtraceauto>` as the very first thing
1313
in your application. This will only work if your application is not running under ``ddtrace-run``.
1414

15-
``patch_all``
16-
-------------
17-
18-
For fine-grained control over instrumentation setup, use ``patch_all`` as early as possible
19-
in the application::
20-
21-
from ddtrace import patch_all
22-
patch_all()
23-
24-
To toggle instrumentation for a particular module::
25-
26-
from ddtrace import patch_all
27-
patch_all(redis=False, cassandra=False)
28-
29-
By default all supported libraries will be instrumented when ``patch_all`` is
30-
used.
31-
32-
**Note:** To ensure that the supported libraries are instrumented properly in
33-
the application, they must be patched *prior* to being imported. So make sure
34-
to call ``patch_all`` *before* importing libraries that are to be instrumented.
35-
36-
More information about ``patch_all`` is available in the :py:func:`patch_all<ddtrace.patch_all>` API
37-
documentation.
15+
Note: Some Datadog products and instrumentation are disabled by default. Products and instrumentation can be enabled/disable via environment variables, see :ref:`configurations <Configuration>` page for more details.
3816

17+
Tracing
18+
~~~~~~~
3919

4020
Manual Instrumentation
4121
----------------------

docs/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ contacting support.
186186

187187
.. [1] Libraries that are automatically instrumented when the
188188
:ref:`ddtrace-run<ddtracerun>` command is used or the ``import ddtrace.auto`` import
189-
is used. Always use ``patch()``, ``patch_all()``, and ``import ddtrace.auto`` as soon
189+
is used. Always use ``import ddtrace.auto`` as soon
190190
as possible in your Python entrypoint.
191191
192192
.. [2] only the synchronous client

docs/installation_quickstart.rst

-18
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,6 @@ When ``ddtrace-run`` cannot be used, a similar start-up behavior can be achieved
5959
with the import of ``ddtrace.auto``. This should normally be imported as the
6060
first thing during the application start-up.
6161

62-
If neither ``ddtrace-run`` nor ``import ddtrace.auto`` are suitable for your application, then
63-
:py:func:`ddtrace.patch_all` can be used to configure the tracer::
64-
65-
from ddtrace import config, patch_all
66-
67-
config.env = "dev" # the environment the application is in
68-
config.service = "app" # name of your application
69-
config.version = "0.1" # version of your application
70-
patch_all()
71-
72-
73-
.. note::
74-
We recommend the use of ``ddtrace-run`` when possible. If you are importing
75-
``ddtrace.auto`` as a programmatic replacement for ``ddtrace``, then note
76-
that integrations will take their configuration from the environment
77-
variables. A call to :py:func:`ddtrace.patch_all` cannot be used to disable
78-
an integration at this point.
79-
8062

8163
Service names also need to be configured for libraries that query other
8264
services (``requests``, ``grpc``, database libraries, etc). Check out the

0 commit comments

Comments
 (0)