Skip to content

Commit c092d57

Browse files
committed
chore(tracing): remove deprecated modules 3.0
1 parent a75aa9a commit c092d57

File tree

11 files changed

+25
-198
lines changed

11 files changed

+25
-198
lines changed

ddtrace/__init__.py

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@
2525

2626
from ._monkey import patch # noqa: E402
2727
from ._monkey import patch_all # noqa: E402
28-
from .internal.compat import PYTHON_VERSION_INFO # noqa: E402
29-
from .internal.utils.deprecations import DDTraceDeprecationWarning # noqa: E402
30-
from ddtrace._trace.pin import Pin # noqa: E402
31-
from ddtrace._trace.span import Span # noqa: E402
32-
from ddtrace._trace.tracer import Tracer # noqa: E402
33-
from ddtrace.vendor import debtcollector
3428
from .version import get_version # noqa: E402
3529

3630

@@ -39,15 +33,6 @@
3933

4034
_start_mini_agent()
4135

42-
# DEV: Import deprecated tracer module in order to retain side-effect of package
43-
# initialization, which added this module to sys.modules. We catch deprecation
44-
# warnings as this is only to retain a side effect of the package
45-
# initialization.
46-
# TODO: Remove this in v3.0 when the ddtrace/tracer.py module is removed
47-
with warnings.catch_warnings():
48-
warnings.simplefilter("ignore")
49-
from .tracer import Tracer as _
50-
5136
__version__ = get_version()
5237

5338
# TODO: Deprecate accessing tracer from ddtrace.__init__ module in v4.0
@@ -57,47 +42,5 @@
5742
__all__ = [
5843
"patch",
5944
"patch_all",
60-
"Pin",
61-
"Span",
62-
"Tracer",
6345
"config",
64-
"DDTraceDeprecationWarning",
65-
]
66-
67-
68-
_DEPRECATED_TRACE_ATTRIBUTES = [
69-
"Span",
70-
"Tracer",
71-
"Pin",
7246
]
73-
74-
75-
def __getattr__(name):
76-
if name in _DEPRECATED_TRACE_ATTRIBUTES:
77-
debtcollector.deprecate(
78-
("%s.%s is deprecated" % (__name__, name)),
79-
message="Import from ddtrace.trace instead.",
80-
category=DDTraceDeprecationWarning,
81-
removal_version="3.0.0",
82-
)
83-
84-
if name in globals():
85-
return globals()[name]
86-
87-
raise AttributeError("%s has no attribute %s", __name__, name)
88-
89-
90-
def check_supported_python_version():
91-
if PYTHON_VERSION_INFO < (3, 8):
92-
deprecation_message = (
93-
"Support for ddtrace with Python version %d.%d is deprecated and will be removed in 3.0.0."
94-
)
95-
if PYTHON_VERSION_INFO < (3, 7):
96-
deprecation_message = "Support for ddtrace with Python version %d.%d was removed in 2.0.0."
97-
debtcollector.deprecate(
98-
(deprecation_message % (PYTHON_VERSION_INFO[0], PYTHON_VERSION_INFO[1])),
99-
category=DDTraceDeprecationWarning,
100-
)
101-
102-
103-
check_supported_python_version()

ddtrace/constants.py

Lines changed: 21 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,37 @@
1-
from ddtrace.internal.utils.deprecations import DDTraceDeprecationWarning as _DDTraceDeprecationWarning
2-
from ddtrace.vendor import debtcollector as _debtcollector
3-
4-
5-
# TODO: Deprecate and remove the SAMPLE_RATE_METRIC_KEY constant.
6-
# This key enables legacy trace sampling support in the Datadog agent.
7-
_SAMPLE_RATE_METRIC_KEY = SAMPLE_RATE_METRIC_KEY = "_sample_rate"
8-
_SAMPLING_PRIORITY_KEY = SAMPLING_PRIORITY_KEY = "_sampling_priority_v1"
9-
_ANALYTICS_SAMPLE_RATE_KEY = ANALYTICS_SAMPLE_RATE_KEY = "_dd1.sr.eausr"
10-
_SAMPLING_AGENT_DECISION = SAMPLING_AGENT_DECISION = "_dd.agent_psr"
11-
_SAMPLING_RULE_DECISION = SAMPLING_RULE_DECISION = "_dd.rule_psr"
12-
_SAMPLING_LIMIT_DECISION = SAMPLING_LIMIT_DECISION = "_dd.limit_psr"
1+
"""
2+
This module contains constants used across ddtrace products.
3+
4+
Constants that should NOT be referenced by ddtrace users are marked with a leading underscore.
5+
"""
6+
_SAMPLING_PRIORITY_KEY = "_sampling_priority_v1"
7+
_ANALYTICS_SAMPLE_RATE_KEY = "_dd1.sr.eausr"
8+
_SAMPLING_AGENT_DECISION = "_dd.agent_psr"
9+
_SAMPLING_RULE_DECISION = "_dd.rule_psr"
10+
_SAMPLING_LIMIT_DECISION = "_dd.limit_psr"
1311
_SINGLE_SPAN_SAMPLING_MECHANISM = "_dd.span_sampling.mechanism"
1412
_SINGLE_SPAN_SAMPLING_RATE = "_dd.span_sampling.rule_rate"
1513
_SINGLE_SPAN_SAMPLING_MAX_PER_SEC = "_dd.span_sampling.max_per_second"
1614
_SINGLE_SPAN_SAMPLING_MAX_PER_SEC_NO_LIMIT = -1
1715
_APM_ENABLED_METRIC_KEY = "_dd.apm.enabled"
1816

19-
_ORIGIN_KEY = ORIGIN_KEY = "_dd.origin"
20-
_USER_ID_KEY = USER_ID_KEY = "_dd.p.usr.id"
21-
_HOSTNAME_KEY = HOSTNAME_KEY = "_dd.hostname"
22-
_RUNTIME_FAMILY = RUNTIME_FAMILY = "_dd.runtime_family"
17+
_ORIGIN_KEY = "_dd.origin"
18+
_USER_ID_KEY = "_dd.p.usr.id"
19+
_HOSTNAME_KEY = "_dd.hostname"
20+
_RUNTIME_FAMILY = "_dd.runtime_family"
2321
ENV_KEY = "env"
2422
VERSION_KEY = "version"
2523
SERVICE_KEY = "service.name"
26-
_BASE_SERVICE_KEY = BASE_SERVICE_KEY = "_dd.base_service"
24+
_BASE_SERVICE_KEY = "_dd.base_service"
2725
SERVICE_VERSION_KEY = "service.version"
2826
SPAN_KIND = "span.kind"
29-
_SPAN_MEASURED_KEY = SPAN_MEASURED_KEY = "_dd.measured"
30-
_KEEP_SPANS_RATE_KEY = KEEP_SPANS_RATE_KEY = "_dd.tracer_kr"
31-
_MULTIPLE_IP_HEADERS = MULTIPLE_IP_HEADERS = "_dd.multiple-ip-headers"
27+
_SPAN_MEASURED_KEY = "_dd.measured"
28+
_KEEP_SPANS_RATE_KEY = "_dd.tracer_kr"
29+
_MULTIPLE_IP_HEADERS = "_dd.multiple-ip-headers"
3230

3331
APPSEC_ENV = "DD_APPSEC_ENABLED"
34-
_CONFIG_ENDPOINT_ENV = CONFIG_ENDPOINT_ENV = "_DD_CONFIG_ENDPOINT"
35-
_CONFIG_ENDPOINT_RETRIES_ENV = CONFIG_ENDPOINT_RETRIES_ENV = "_DD_CONFIG_ENDPOINT_RETRIES"
36-
_CONFIG_ENDPOINT_TIMEOUT_ENV = CONFIG_ENDPOINT_TIMEOUT_ENV = "_DD_CONFIG_ENDPOINT_TIMEOUT"
32+
_CONFIG_ENDPOINT_ENV = "_DD_CONFIG_ENDPOINT"
33+
_CONFIG_ENDPOINT_RETRIES_ENV = "_DD_CONFIG_ENDPOINT_RETRIES"
34+
_CONFIG_ENDPOINT_TIMEOUT_ENV = "_DD_CONFIG_ENDPOINT_TIMEOUT"
3735
IAST_ENV = "DD_IAST_ENABLED"
3836

3937
MANUAL_DROP_KEY = "manual.drop"
@@ -53,38 +51,3 @@
5351
AUTO_KEEP = 1
5452
# Use this to explicitly inform the backend that a trace should be kept and stored.
5553
USER_KEEP = 2
56-
57-
58-
_DEPRECATED_MODULE_ATTRIBUTES = [
59-
"ANALYTICS_SAMPLE_RATE_KEY",
60-
"SAMPLE_RATE_METRIC_KEY",
61-
"SAMPLING_PRIORITY_KEY",
62-
"SAMPLING_AGENT_DECISION",
63-
"SAMPLING_RULE_DECISION",
64-
"SAMPLING_LIMIT_DECISION",
65-
"USER_ID_KEY",
66-
"ORIGIN_KEY",
67-
"HOSTNAME_KEY",
68-
"RUNTIME_FAMILY",
69-
"BASE_SERVICE_KEY",
70-
"SPAN_MEASURED_KEY",
71-
"KEEP_SPANS_RATE_KEY",
72-
"MULTIPLE_IP_HEADERS",
73-
"CONFIG_ENDPOINT_ENV",
74-
"CONFIG_ENDPOINT_RETRIES_ENV",
75-
"CONFIG_ENDPOINT_TIMEOUT_ENV",
76-
]
77-
78-
79-
def __getattr__(name):
80-
if name in _DEPRECATED_MODULE_ATTRIBUTES:
81-
_debtcollector.deprecate(
82-
("%s.%s is deprecated" % (__name__, name)),
83-
category=_DDTraceDeprecationWarning,
84-
removal_version="3.0.0",
85-
)
86-
87-
if name in globals():
88-
return globals()[name]
89-
90-
raise AttributeError("%s has no attribute %s", __name__, name)

ddtrace/context.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

ddtrace/filters.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

ddtrace/pin.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

ddtrace/provider.py

Lines changed: 0 additions & 13 deletions
This file was deleted.

ddtrace/sampler.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

ddtrace/sampling_rule.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

ddtrace/span.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

ddtrace/tracer.py

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
other:
3+
- |
4+
tracing: Removed deprecated tracing modules `ddtrace` package.

0 commit comments

Comments
 (0)