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

chore(integrations): remove deprecated code [3.0] #12105

Merged
merged 44 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
a5b1efc
chore: avoid patching using the public api
mabdinur Jan 27, 2025
741b7f5
fix asgi regression
mabdinur Jan 27, 2025
bd044e3
rn
mabdinur Jan 27, 2025
5d2785a
fix patch_all and lint
mabdinur Jan 27, 2025
3afb70a
remove deprecated code
mabdinur Jan 27, 2025
f254f22
fix redis utils and coverage
mabdinur Jan 27, 2025
134e459
Merge branch 'munir/ensure-all-integrations-have-patch-module' into m…
mabdinur Jan 27, 2025
28decfe
remove prefix from patch
mabdinur Jan 28, 2025
9b6a498
fix suitespec
mabdinur Jan 28, 2025
fb68d44
fmt
mabdinur Jan 28, 2025
370ed26
Merge branch 'munir/ensure-all-integrations-have-patch-module' into m…
mabdinur Jan 28, 2025
f5c5be6
update starlette and monkey code
mabdinur Jan 28, 2025
ee937e8
Merge branch 'munir/ensure-all-integrations-have-patch-module' into m…
mabdinur Jan 28, 2025
24dc8ae
clean up googleai and fix rel imports
mabdinur Jan 28, 2025
302c4bb
fix aiohttp, requests, and opentracing
mabdinur Jan 28, 2025
068a997
revert require get_version
mabdinur Jan 28, 2025
106198b
fmt
mabdinur Jan 28, 2025
51a9e15
Merge branch 'munir/ensure-all-integrations-have-patch-module' into m…
mabdinur Jan 28, 2025
9572233
fix aioredis
mabdinur Jan 28, 2025
d22824a
Merge branch 'munir/ensure-all-integrations-have-patch-module' into m…
mabdinur Jan 28, 2025
3d12d54
make sure trace handlers are registered
mabdinur Jan 28, 2025
35f026b
fmt
mabdinur Jan 28, 2025
9df7796
lint
mabdinur Jan 28, 2025
b9e51fb
fix sampling rule benchmarks
mabdinur Jan 28, 2025
902750c
fix docs
mabdinur Jan 29, 2025
c3cd2ce
fix docs
mabdinur Jan 29, 2025
b63ab7b
Merge remote-tracking branch 'origin/3.x-staging' into munir/remove-d…
mabdinur Jan 29, 2025
07f6feb
revert benchmarks change
mabdinur Jan 29, 2025
d4496b5
remove cargo lock file
mabdinur Jan 29, 2025
abe58bc
update suitspec to include internal redis and async utils
mabdinur Jan 29, 2025
5f7c535
remove dbapi file
mabdinur Jan 29, 2025
f6f2e67
Merge remote-tracking branch 'origin/3.x-staging' into munir/remove-d…
mabdinur Jan 29, 2025
e203d2b
rn
mabdinur Jan 30, 2025
0d46738
chore(aws_lambda): bump minimum supported version
mabdinur Jan 30, 2025
50ad4a4
ci(aws_Lambda): bump minimum tested version
mabdinur Jan 30, 2025
45731d3
Merge branch '3.x-staging' into munir/upgrade-min-aws-lambda
mabdinur Jan 30, 2025
8d2d4e8
test against more py versions
mabdinur Jan 31, 2025
ff6120c
bump pinned ddtrace version
mabdinur Jan 31, 2025
cc81d15
Merge branch 'munir/upgrade-min-aws-lambda' into munir/remove-depreca…
mabdinur Jan 31, 2025
bcf8cba
Merge branch '3.x-staging' into munir/remove-deprecated-code-integrat…
mabdinur Jan 31, 2025
a08ff8f
Update ddtrace/contrib/__init__.py
mabdinur Feb 3, 2025
910a9a3
Merge remote-tracking branch 'origin/3.x-staging' into munir/remove-d…
mabdinur Feb 3, 2025
b1cda1b
fix merge conflict
mabdinur Feb 3, 2025
2a21edf
Merge remote-tracking branch 'origin/3.x-staging' into munir/remove-d…
mabdinur Feb 3, 2025
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
76 changes: 3 additions & 73 deletions ddtrace/contrib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,73 +1,3 @@
from ddtrace._trace import trace_handlers # noqa:F401
from ddtrace.internal.utils.deprecations import DDTraceDeprecationWarning
from ddtrace.internal.utils.importlib import func_name # noqa:F401
from ddtrace.internal.utils.importlib import module_name # noqa:F401
from ddtrace.internal.utils.importlib import require_modules # noqa:F401
from ddtrace.vendor.debtcollector import deprecate


def __getattr__(name):
if name in (
"aiohttp",
"asgi",
"bottle",
"celery",
"cherrypy",
"falcon",
"flask_cache",
"pylibmc",
"pyramid",
"requests",
"sqlalchemy",
"wsgi",
"trace_utils",
"internal",
):
# following packages/modules are not deprecated and will not be removed in 3.0
pass
elif name in ("trace_handlers", "func_name", "module_name", "require_modules"):
# the following attributes are exposed in ddtrace.contrib.__init__ and should be
# removed in v3.0
deprecate(
("ddtrace.contrib.%s is deprecated" % name),
category=DDTraceDeprecationWarning,
removal_version="3.0.0",
)
elif name in ("aiobotocore", "httplib", "kombu", "snowflake", "sqlalchemy", "tornado", "urllib3"):
# following integrations are not enabled by default and require a unique deprecation message
deprecate(
f"ddtrace.contrib.{name} is deprecated",
message="Avoid using this package directly. "
f"Set DD_TRACE_{name.upper()}_ENABLED=true and use ``ddtrace.auto`` or the "
"``ddtrace-run`` command to enable and configure this integration.",
category=DDTraceDeprecationWarning,
removal_version="3.0.0",
)
elif name in ("redis_utils", "trace_utils_redis", "trace_utils_async"):
deprecate(
f"The ddtrace.contrib.{name} module is deprecated",
message="Import from ``ddtrace.contrib.trace_utils`` instead.",
category=DDTraceDeprecationWarning,
removal_version="3.0.0",
)
elif name == "flask_login":
deprecate(
"""The flask_login integration is deprecated and will be deleted.
We recommend customers to switch to manual instrumentation.
https://docs.datadoghq.com/security/application_security/threats/add-user-info/?tab=loginsuccess&code-lang=python#adding-business-logic-information-login-success-login-failure-any-business-logic-to-traces
""",
message="",
category=DDTraceDeprecationWarning,
)
else:
deprecate(
f"ddtrace.contrib.{name} is deprecated",
message="Avoid using this package directly. "
f"Use ``import ddtrace.auto`` or the ``ddtrace-run`` command to enable and configure {name}.",
category=DDTraceDeprecationWarning,
removal_version="3.0.0",
)

if name in globals():
return globals()[name]
raise AttributeError("%s has no attribute %s", __name__, name)
# Importing trace handlers has the side effect of registering integration level
# handlers. This is necessary to use the Core API in integrations.
from ddtrace._trace import trace_handlers as _ # noqa: F401
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,3 @@
Default: ``False``

"""


# Required to allow users to import from `ddtrace.contrib.aiobotocore.patch` directly
import warnings as _w


with _w.catch_warnings():
_w.simplefilter("ignore", DeprecationWarning)
from . import patch as _ # noqa: F401, I001


from ddtrace.contrib.internal.aiobotocore.patch import get_version # noqa: F401
from ddtrace.contrib.internal.aiobotocore.patch import patch # noqa: F401
15 changes: 15 additions & 0 deletions ddtrace/contrib/_aiohttp_jinja2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
vitor-de-araujo marked this conversation as resolved.
Show resolved Hide resolved
The ``aiohttp_jinja2`` integration adds tracing of template rendering.


Enabling
~~~~~~~~

The integration is enabled automatically when using
:ref:`ddtrace-run<ddtracerun>` or :ref:`import ddtrace.auto<ddtraceauto>`.

Or use :func:`patch()<ddtrace.patch>` to manually enable the integration::

from ddtrace import patch
patch(aiohttp_jinja2=True)
"""
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,3 @@
cur = await conn.cursor()
await cur.execute("SELECT 6*7 AS the_answer;")
"""


# Required to allow users to import from `ddtrace.contrib.aiohttp.patch` directly
import warnings as _w


with _w.catch_warnings():
_w.simplefilter("ignore", DeprecationWarning)
from . import patch as _ # noqa: F401, I001

from ddtrace.contrib.internal.aiomysql.patch import get_version # noqa: F401
from ddtrace.contrib.internal.aiomysql.patch import patch # noqa: F401
from ddtrace.contrib.internal.aiomysql.patch import unpatch # noqa: F401
12 changes: 0 additions & 12 deletions ddtrace/contrib/aiopg/__init__.py → ddtrace/contrib/_aiopg.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,3 @@
# Use a pin to specify metadata related to this connection
Pin.override(db, service='postgres-users')
"""


# Required to allow users to import from `ddtrace.contrib.aiohttp.patch` directly
import warnings as _w


with _w.catch_warnings():
_w.simplefilter("ignore", DeprecationWarning)
from . import patch as _ # noqa: F401, I001

from ddtrace.contrib.internal.aiopg.patch import get_version # noqa: F401
from ddtrace.contrib.internal.aiopg.patch import patch # noqa: F401
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,3 @@
myaioredis = aioredis.Aioredis()
Pin.override(myaioredis, service="myaioredis")
"""
import warnings as _w # noqa: E402


with _w.catch_warnings():
_w.simplefilter("ignore", DeprecationWarning)
# Required to allow users to import from `ddtrace.contrib.aioredis.patch` directly
from . import patch as _ # noqa: I001,F401

from ddtrace.contrib.internal.aioredis.patch import get_version # noqa: F401
from ddtrace.contrib.internal.aioredis.patch import patch # noqa: F401
from ddtrace.contrib.internal.aioredis.patch import unpatch # noqa: F401
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,3 @@

.. __: https://www.algolia.com
"""


# Required to allow users to import from `ddtrace.contrib.algoliasearch.patch` directly
import warnings as _w


with _w.catch_warnings():
_w.simplefilter("ignore", DeprecationWarning)
from . import patch as _ # noqa: F401, I001

from ddtrace.contrib.internal.algoliasearch.patch import get_version # noqa: F401
from ddtrace.contrib.internal.algoliasearch.patch import patch # noqa: F401
from ddtrace.contrib.internal.algoliasearch.patch import unpatch # noqa: F401
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,3 @@

Pin.override(anthropic, service="my-anthropic-service")
""" # noqa: E501


# Required to allow users to import from `ddtrace.contrib.anthropic.patch` directly
import warnings as _w


with _w.catch_warnings():
_w.simplefilter("ignore", DeprecationWarning)
from . import patch as _ # noqa: F401, I001

from ddtrace.contrib.internal.anthropic.patch import get_version # noqa: F401
from ddtrace.contrib.internal.anthropic.patch import patch # noqa: F401
from ddtrace.contrib.internal.anthropic.patch import unpatch # noqa: F401
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,3 @@
async def example():
await client.get("my-key")
"""


# Required to allow users to import from `ddtrace.contrib.aredis.patch` directly
import warnings as _w


with _w.catch_warnings():
_w.simplefilter("ignore", DeprecationWarning)
from . import patch as _ # noqa: F401, I001

from ddtrace.contrib.internal.aredis.patch import get_version # noqa: F401
from ddtrace.contrib.internal.aredis.patch import patch # noqa: F401
4 changes: 4 additions & 0 deletions ddtrace/contrib/_asyncio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""
This integration provides context management for tracing the execution flow
of concurrent execution of ``asyncio.Task``.
"""
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,3 @@
conn = asyncpg.connect("postgres://localhost:5432")
Pin.override(conn, service="custom-service")
"""


# Required to allow users to import from `ddtrace.contrib.asyncpg.patch` directly
import warnings as _w


with _w.catch_warnings():
_w.simplefilter("ignore", DeprecationWarning)
from . import patch as _ # noqa: F401, I001

from ddtrace.contrib.internal.asyncpg.patch import get_version # noqa: F401
from ddtrace.contrib.internal.asyncpg.patch import patch # noqa: F401
from ddtrace.contrib.internal.asyncpg.patch import unpatch # noqa: F401
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@
~~~~~~~~~~~~~

"""

from ..internal.avro.patch import get_version # noqa: F401
from ..internal.avro.patch import patch # noqa: F401
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,3 @@
For additional configuration refer to
`Instrumenting Python Serverless Applications by Datadog <https://docs.datadoghq.com/serverless/installation/python>`_.
"""

from ddtrace.contrib.internal.aws_lambda.patch import get_version # noqa: F401
from ddtrace.contrib.internal.aws_lambda.patch import patch # noqa: F401
from ddtrace.contrib.internal.aws_lambda.patch import unpatch # noqa: F401
25 changes: 25 additions & 0 deletions ddtrace/contrib/_azure_functions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""
The azure_functions integration traces all http requests to your Azure Function app.

Enabling
~~~~~~~~

Use :func:`patch()<ddtrace.patch>` to manually enable the integration::

from ddtrace import patch
patch(azure_functions=True)


Global Configuration
~~~~~~~~~~~~~~~~~~~~

.. py:data:: ddtrace.config.azure_functions["service"]

The service name reported by default for azure_functions instances.

This option can also be set with the ``DD_SERVICE`` environment
variable.

Default: ``"azure_functions"``

"""
12 changes: 0 additions & 12 deletions ddtrace/contrib/boto/__init__.py → ddtrace/contrib/_boto.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,3 @@
Default: ``False``

"""


# Required to allow users to import from `ddtrace.contrib.boto.patch` directly
import warnings as _w


with _w.catch_warnings():
_w.simplefilter("ignore", DeprecationWarning)
from . import patch as _ # noqa: F401, I001

from ddtrace.contrib.internal.boto.patch import get_version # noqa: F401
from ddtrace.contrib.internal.boto.patch import patch # noqa: F401
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,3 @@
Default: ``True``

"""


# Required to allow users to import from `ddtrace.contrib.botocore.patch` directly
import warnings as _w


with _w.catch_warnings():
_w.simplefilter("ignore", DeprecationWarning)
from . import patch as _ # noqa: F401, I001

from ddtrace.contrib.internal.botocore.patch import get_version # noqa: F401
from ddtrace.contrib.internal.botocore.patch import patch # noqa: F401
from ddtrace.contrib.internal.botocore.patch import patch_submodules # noqa: F401
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,3 @@
session = cluster.connect("my_keyspace")
session.execute("select id from my_table limit 10;")
"""


# Required to allow users to import from `ddtrace.contrib.cassandra.patch` directly
import warnings as _w


with _w.catch_warnings():
_w.simplefilter("ignore", DeprecationWarning)
from . import patch as _ # noqa: F401, I001


from ddtrace.contrib.internal.cassandra.patch import patch # noqa: F401
from ddtrace.contrib.internal.cassandra.session import get_version # noqa: F401
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,3 @@
# Use a pin to specify metadata related to this client
Pin.override(client, service='consul-kv')
"""


# Required to allow users to import from `ddtrace.contrib.consul.patch` directly
import warnings as _w


with _w.catch_warnings():
_w.simplefilter("ignore", DeprecationWarning)
from . import patch as _ # noqa: F401, I001


from ddtrace.contrib.internal.consul.patch import get_version # noqa: F401
from ddtrace.contrib.internal.consul.patch import patch # noqa: F401
from ddtrace.contrib.internal.consul.patch import unpatch # noqa: F401
17 changes: 17 additions & 0 deletions ddtrace/contrib/_coverage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
The Coverage.py integration traces test code coverage when using `pytest` or `unittest`.
Enabling
~~~~~~~~
The Coverage.py integration is enabled automatically when using
:ref:`ddtrace-run<ddtracerun>` or :ref:`import ddtrace.auto<ddtraceauto>`.
Alternately, use :func:`patch()<ddtrace.patch>` to manually enable the integration::
from ddtrace import patch
patch(coverage=True)
Note: Coverage.py instrumentation is only enabled if `pytest` or `unittest` instrumentation is enabled.
"""
Original file line number Diff line number Diff line change
Expand Up @@ -200,18 +200,3 @@

.. __: https://www.djangoproject.com/
""" # noqa: E501


# Required to allow users to import from `ddtrace.contrib.django.patch` directly
import warnings as _w


with _w.catch_warnings():
_w.simplefilter("ignore", DeprecationWarning)
from . import patch as _ # noqa: F401, I001


from ddtrace.contrib.internal.django.patch import get_version # noqa: F401
from ddtrace.contrib.internal.django.patch import patch # noqa: F401
from ddtrace.contrib.internal.django.patch import patch as _patch # noqa: F401
from ddtrace.contrib.internal.django.patch import unpatch # noqa: F401
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,3 @@ def hello(name):

.. __: https://dogpilecache.sqlalchemy.org/
"""


# Required to allow users to import from `ddtrace.contrib.dogpile_cache.patch` directly
import warnings as _w


with _w.catch_warnings():
_w.simplefilter("ignore", DeprecationWarning)
from . import patch as _ # noqa: F401, I001


from ddtrace.contrib.internal.dogpile_cache.patch import get_version # noqa: F401
from ddtrace.contrib.internal.dogpile_cache.patch import patch # noqa: F401
from ddtrace.contrib.internal.dogpile_cache.patch import unpatch # noqa: F401
Loading
Loading