Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(tracing): remove patch_all from basic usage docs [3.0] #11868

Merged
merged 8 commits into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ddtrace/_monkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def on_import(hook):

def patch_all(**patch_modules):
# type: (bool) -> None
"""Automatically patches all available modules.
"""Enables ddtrace library instrumentation.

In addition to ``patch_modules``, an override can be specified via an
environment variable, ``DD_TRACE_<module>_ENABLED`` for each module.
Expand Down
32 changes: 6 additions & 26 deletions docs/basic_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,19 @@
Basic Usage
===========

Tracing
~~~~~~~
Automatic Instrumentation
~~~~~~~~~~~~~~~~~~~~~~~~~

``ddtrace.auto``
----------------

To set up instrumentation within your application, call :ref:`import ddtrace.auto<ddtraceauto>` as early as possible
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
in your application. This will only work if your application is not running under ``ddtrace-run``.

``patch_all``
-------------

For fine-grained control over instrumentation setup, use ``patch_all`` as early as possible
in the application::

from ddtrace import patch_all
patch_all()

To toggle instrumentation for a particular module::

from ddtrace import patch_all
patch_all(redis=False, cassandra=False)

By default all supported libraries will be instrumented when ``patch_all`` is
used.

**Note:** To ensure that the supported libraries are instrumented properly in
the application, they must be patched *prior* to being imported. So make sure
to call ``patch_all`` *before* importing libraries that are to be instrumented.

More information about ``patch_all`` is available in the :py:func:`patch_all<ddtrace.patch_all>` API
documentation.
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.

Tracing
~~~~~~~

Manual Instrumentation
----------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ contacting support.

.. [1] Libraries that are automatically instrumented when the
:ref:`ddtrace-run<ddtracerun>` command is used or the ``import ddtrace.auto`` import
is used. Always use ``patch()``, ``patch_all()``, and ``import ddtrace.auto`` as soon
is used. Always use ``import ddtrace.auto`` as soon
as possible in your Python entrypoint.

.. [2] only the synchronous client
Expand Down
18 changes: 0 additions & 18 deletions docs/installation_quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,6 @@ When ``ddtrace-run`` cannot be used, a similar start-up behavior can be achieved
with the import of ``ddtrace.auto``. This should normally be imported as the
first thing during the application start-up.

If neither ``ddtrace-run`` nor ``import ddtrace.auto`` are suitable for your application, then
:py:func:`ddtrace.patch_all` can be used to configure the tracer::

from ddtrace import config, patch_all

config.env = "dev" # the environment the application is in
config.service = "app" # name of your application
config.version = "0.1" # version of your application
patch_all()


.. note::
We recommend the use of ``ddtrace-run`` when possible. If you are importing
``ddtrace.auto`` as a programmatic replacement for ``ddtrace``, then note
that integrations will take their configuration from the environment
variables. A call to :py:func:`ddtrace.patch_all` cannot be used to disable
an integration at this point.


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