Skip to content

Commit

Permalink
Remove deprecated items.
Browse files Browse the repository at this point in the history
  • Loading branch information
Yun-Kim committed Aug 8, 2023
1 parent 3fbb4eb commit 53ac887
Show file tree
Hide file tree
Showing 47 changed files with 812 additions and 2,153 deletions.
7 changes: 0 additions & 7 deletions ddtrace/bootstrap/sitecustomize.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,6 @@
log = get_logger(__name__)


if os.environ.get("DD_GEVENT_PATCH_ALL") is not None:
deprecate(
"The environment variable DD_GEVENT_PATCH_ALL is deprecated and will be removed in a future version. ",
postfix="There is no special configuration necessary to make ddtrace work with gevent if using ddtrace-run. "
"If not using ddtrace-run, import ddtrace.auto before calling gevent.monkey.patch_all().",
removal_version="2.0.0",
)
if "gevent" in sys.modules or "gevent.monkey" in sys.modules:
import gevent.monkey # noqa

Expand Down
30 changes: 0 additions & 30 deletions ddtrace/constants.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,4 @@
from ddtrace.internal.compat import ensure_pep562
from ddtrace.vendor.debtcollector import deprecate


deprecated_names = {
"APPSEC_ENABLED": "_dd.appsec.enabled",
"APPSEC_JSON": "_dd.appsec.json",
"APPSEC_EVENT_RULE_VERSION": "_dd.appsec.event_rules.version",
"APPSEC_EVENT_RULE_ERRORS": "_dd.appsec.event_rules.errors",
"APPSEC_EVENT_RULE_LOADED": "_dd.appsec.event_rules.loaded",
"APPSEC_EVENT_RULE_ERROR_COUNT": "_dd.appsec.event_rules.error_count",
"APPSEC_WAF_DURATION": "_dd.appsec.waf.duration",
"APPSEC_WAF_DURATION_EXT": "_dd.appsec.waf.duration_ext",
"APPSEC_WAF_TIMEOUTS": "_dd.appsec.waf.timeouts",
"APPSEC_WAF_VERSION": "_dd.appsec.waf.version",
"APPSEC_ORIGIN_VALUE": "appsec",
"APPSEC_BLOCKED": "appsec.blocked",
"IAST_JSON": "_dd.iast.json",
"IAST_ENABLED": "_dd.iast.enabled",
"IAST_CONTEXT_KEY": "_iast_data",
}


def __getattr__(name):
if name in deprecated_names:
deprecate(
("%s.%s is deprecated" % (__name__, name)),
removal_version="2.0.0",
)
return deprecated_names[name]
raise AttributeError("'%s' has no attribute '%s'", __name__, name)


SAMPLE_RATE_METRIC_KEY = "_sample_rate"
Expand Down
15 changes: 0 additions & 15 deletions ddtrace/contrib/aiobotocore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,6 @@
Default: ``False``
.. py:data:: ddtrace.config.aiobotocore['tag_all_params']
**Deprecated**: This retains the deprecated behavior of adding span tags for
all API parameters that are not explicitly excluded by the integration.
These deprecated span tags will be added along with the API parameters
enabled by default.
This configuration is ignored if ``tag_no_parms`` (``DD_AWS_TAG_NO_PARAMS``)
is set to ``True``.
To collect all API parameters, ``ddtrace.config.botocore.tag_all_params =
True`` or by setting the environment variable ``DD_AWS_TAG_ALL_PARAMS=true``.
Default: ``False``
"""
from ...internal.utils.importlib import require_modules

Expand Down
12 changes: 0 additions & 12 deletions ddtrace/contrib/aiobotocore/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from ddtrace import config
from ddtrace.internal.constants import COMPONENT
from ddtrace.internal.utils.version import parse_version
from ddtrace.vendor import debtcollector
from ddtrace.vendor import wrapt

from ...constants import ANALYTICS_SAMPLE_RATE_KEY
Expand Down Expand Up @@ -40,18 +39,10 @@
TRACED_ARGS = {"params", "path", "verb"}


if os.getenv("DD_AWS_TAG_ALL_PARAMS") is not None:
debtcollector.deprecate(
"Using environment variable 'DD_AWS_TAG_ALL_PARAMS' is deprecated",
message="The aiobotocore integration no longer includes all API parameters by default.",
removal_version="2.0.0",
)

config._add(
"aiobotocore",
{
"tag_no_params": asbool(os.getenv("DD_AWS_TAG_NO_PARAMS", default=False)),
"tag_all_params": asbool(os.getenv("DD_AWS_TAG_ALL_PARAMS", default=False)),
},
)

Expand Down Expand Up @@ -147,9 +138,6 @@ async def _wrapped_api_call(original_func, instance, args, kwargs):
operation = None
span.resource = endpoint_name

if not config.aiobotocore["tag_no_params"] and config.aiobotocore["tag_all_params"]:
aws.add_span_arg_tags(span, endpoint_name, args, ARGS_NAME, TRACED_ARGS)

region_name = deep_getattr(instance, "meta.region_name")

meta = {
Expand Down
16 changes: 0 additions & 16 deletions ddtrace/contrib/boto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,6 @@
True`` or by setting the environment variable ``DD_AWS_TAG_NO_PARAMS=true``.
Default: ``False``
.. py:data:: ddtrace.config.boto['tag_all_params']
**Deprecated**: This retains the deprecated behavior of adding span tags for
all API parameters that are not explicitly excluded by the integration.
These deprecated span tags will be added along with the API parameters
enabled by default.
This configuration is ignored if ``tag_no_parms`` (``DD_AWS_TAG_NO_PARAMS``)
is set to ``True``.
To collect all API parameters, ``ddtrace.config.botocore.tag_all_params =
True`` or by setting the environment variable ``DD_AWS_TAG_ALL_PARAMS=true``.
Default: ``False``
"""
Expand Down
15 changes: 0 additions & 15 deletions ddtrace/contrib/boto/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from ddtrace.internal.constants import COMPONENT
from ddtrace.internal.utils.wrappers import unwrap
from ddtrace.pin import Pin
from ddtrace.vendor import debtcollector
from ddtrace.vendor import wrapt

from ...internal.schema import schematize_cloud_api_operation
Expand All @@ -40,18 +39,10 @@
AWS_AUTH_TRACED_ARGS = {"path", "data", "host"}


if os.getenv("DD_AWS_TAG_ALL_PARAMS") is not None:
debtcollector.deprecate(
"Using environment variable 'DD_AWS_TAG_ALL_PARAMS' is deprecated",
message="The boto integration no longer includes all API parameters by default.",
removal_version="2.0.0",
)

config._add(
"boto",
{
"tag_no_params": asbool(os.getenv("DD_AWS_TAG_NO_PARAMS", default=False)),
"tag_all_params": asbool(os.getenv("DD_AWS_TAG_ALL_PARAMS", default=False)),
},
)

Expand Down Expand Up @@ -112,9 +103,6 @@ def patched_query_request(original_func, instance, args, kwargs):
else:
span.resource = endpoint_name

if not config.boto["tag_no_params"] and config.boto["tag_all_params"]:
aws.add_span_arg_tags(span, endpoint_name, args, AWS_QUERY_ARGS_NAME, AWS_QUERY_TRACED_ARGS)

# Obtaining region name
region_name = _get_instance_region_name(instance)

Expand Down Expand Up @@ -180,9 +168,6 @@ def patched_auth_request(original_func, instance, args, kwargs):
else:
span.resource = endpoint_name

if not config.boto["tag_no_params"] and config.boto["tag_all_params"]:
aws.add_span_arg_tags(span, endpoint_name, args, AWS_AUTH_ARGS_NAME, AWS_AUTH_TRACED_ARGS)

# Obtaining region name
region_name = _get_instance_region_name(instance)

Expand Down
15 changes: 0 additions & 15 deletions ddtrace/contrib/botocore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,6 @@
Default: ``False``
.. py:data:: ddtrace.config.botocore['tag_all_params']
**Deprecated**: This retains the deprecated behavior of adding span tags for
all API parameters that are not explicitly excluded by the integration.
These deprecated span tags will be added along with the API parameters
enabled by default.
This configuration is ignored if ``tag_no_parms`` (``DD_AWS_TAG_NO_PARAMS``)
is set to ``True``.
To collect all API parameters, ``ddtrace.config.botocore.tag_all_params =
True`` or by setting the environment variable ``DD_AWS_TAG_ALL_PARAMS=true``.
Default: ``False``
.. py:data:: ddtrace.config.botocore['instrument_internals']
Expand Down
11 changes: 0 additions & 11 deletions ddtrace/contrib/botocore/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from ddtrace import config
from ddtrace.internal.schema.span_attribute_schema import SpanDirection
from ddtrace.settings.config import Config
from ddtrace.vendor import debtcollector
from ddtrace.vendor import wrapt

from ...constants import ANALYTICS_SAMPLE_RATE_KEY
Expand Down Expand Up @@ -64,12 +63,6 @@

log = get_logger(__name__)

if os.getenv("DD_AWS_TAG_ALL_PARAMS") is not None:
debtcollector.deprecate(
"Using environment variable 'DD_AWS_TAG_ALL_PARAMS' is deprecated",
message="The botocore integration no longer includes all API parameters by default.",
removal_version="2.0.0",
)

# Botocore default settings
config._add(
Expand All @@ -79,7 +72,6 @@
"invoke_with_legacy_context": asbool(os.getenv("DD_BOTOCORE_INVOKE_WITH_LEGACY_CONTEXT", default=False)),
"operations": collections.defaultdict(Config._HTTPServerConfig),
"tag_no_params": asbool(os.getenv("DD_AWS_TAG_NO_PARAMS", default=False)),
"tag_all_params": asbool(os.getenv("DD_AWS_TAG_ALL_PARAMS", default=False)),
"instrument_internals": asbool(os.getenv("DD_BOTOCORE_INSTRUMENT_INTERNALS", default=False)),
},
)
Expand Down Expand Up @@ -530,9 +522,6 @@ def patched_api_call(original_func, instance, args, kwargs):
else:
span.resource = endpoint_name

if not config.botocore["tag_no_params"] and config.botocore["tag_all_params"]:
aws.add_span_arg_tags(span, endpoint_name, args, ARGS_NAME, TRACED_ARGS)

region_name = deep_getattr(instance, "meta.region_name")

span.set_tag_str("aws.agent", "botocore")
Expand Down
11 changes: 0 additions & 11 deletions ddtrace/contrib/fastapi/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@
from ddtrace import Pin
from ddtrace import config
from ddtrace.contrib.asgi.middleware import TraceMiddleware
from ddtrace.contrib.starlette.patch import get_resource
from ddtrace.contrib.starlette.patch import traced_handler
from ddtrace.internal.logger import get_logger
from ddtrace.internal.schema import schematize_service_name
from ddtrace.internal.utils.deprecations import DDTraceDeprecationWarning
from ddtrace.internal.utils.wrappers import unwrap as _u
from ddtrace.vendor.debtcollector import removals
from ddtrace.vendor.wrapt import ObjectProxy
from ddtrace.vendor.wrapt import wrap_function_wrapper as _w

Expand All @@ -23,18 +20,10 @@
_default_service=schematize_service_name("fastapi"),
request_span_name="fastapi.request",
distributed_tracing=True,
aggregate_resources=True,
),
)


@removals.remove(removal_version="2.0.0", category=DDTraceDeprecationWarning)
def span_modifier(span, scope):
resource = get_resource(scope)
if config.fastapi["aggregate_resources"] and resource:
span.resource = "{} {}".format(scope["method"], resource)


def wrap_middleware_stack(wrapped, instance, args, kwargs):
return TraceMiddleware(app=wrapped(*args, **kwargs), integration_config=config.fastapi)

Expand Down
9 changes: 0 additions & 9 deletions ddtrace/contrib/grpc/constants.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import grpc

from ddtrace.internal.compat import ensure_pep562
from ddtrace.vendor.debtcollector import deprecate


GRPC_PIN_MODULE_SERVER = grpc.Server
Expand Down Expand Up @@ -30,14 +29,6 @@


def __getattr__(name):
if name == "GRPC_PORT_KEY":
deprecate(
("%s.%s is deprecated" % (__name__, name)),
postfix=". Use ddtrace.ext.net.TARGET_PORT instead.",
removal_version="2.0.0",
)
return "grpc.port"

if name in globals():
return globals()[name]

Expand Down
35 changes: 0 additions & 35 deletions ddtrace/contrib/starlette/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,15 @@

import starlette
from starlette.middleware import Middleware
from starlette.routing import Match

from ddtrace import config
from ddtrace.contrib.asgi.middleware import TraceMiddleware
from ddtrace.ext import http
from ddtrace.internal.logger import get_logger
from ddtrace.internal.schema import schematize_service_name
from ddtrace.internal.utils import get_argument_value
from ddtrace.internal.utils.deprecations import DDTraceDeprecationWarning
from ddtrace.internal.utils.wrappers import unwrap as _u
from ddtrace.span import Span
from ddtrace.vendor.debtcollector import deprecate
from ddtrace.vendor.debtcollector import removals
from ddtrace.vendor.wrapt import ObjectProxy
from ddtrace.vendor.wrapt import wrap_function_wrapper as _w

Expand All @@ -30,32 +26,10 @@
_default_service=schematize_service_name("starlette"),
request_span_name="starlette.request",
distributed_tracing=True,
aggregate_resources=True,
),
)


@removals.remove(removal_version="2.0.0", category=DDTraceDeprecationWarning)
def get_resource(scope):
path = None
routes = scope["app"].routes
for route in routes:
match, _ = route.matches(scope)
if match == Match.FULL:
path = route.path
break
elif match == Match.PARTIAL and path is None:
path = route.path
return path


@removals.remove(removal_version="2.0.0", category=DDTraceDeprecationWarning)
def span_modifier(span, scope):
resource = get_resource(scope)
if config.starlette["aggregate_resources"] and resource:
span.resource = "{} {}".format(scope["method"], resource)


def traced_init(wrapped, instance, args, kwargs):
mw = kwargs.pop("middleware", [])
mw.insert(0, Middleware(TraceMiddleware, integration_config=config.starlette))
Expand Down Expand Up @@ -96,15 +70,6 @@ def unpatch():


def traced_handler(wrapped, instance, args, kwargs):
if config.starlette.get("aggregate_resources") is False or config.fastapi.get("aggregate_resources") is False:
deprecate(
"ddtrace.contrib.starlette.patch",
message="`aggregate_resources` is deprecated and will be removed in tracer version 2.0.0",
category=DDTraceDeprecationWarning,
)

return wrapped(*args, **kwargs)

# Since handle can be called multiple times for one request, we take the path of each instance
# Then combine them at the end to get the correct resource names
scope = get_argument_value(args, kwargs, 0, "scope") # type: Optional[Dict[str, Any]]
Expand Down
Loading

0 comments on commit 53ac887

Please sign in to comment.