Skip to content

Commit 1e65a98

Browse files
Remove deprecated code (#2666)
* remove deprecated client options * remove .install() * remove new_span
1 parent 2ab3ef4 commit 1e65a98

File tree

5 files changed

+5
-97
lines changed

5 files changed

+5
-97
lines changed

MIGRATION_GUIDE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,14 @@
2020
- Removed support for Flask 0.\*.
2121
- `sentry_sdk._functools` was removed.
2222
- A number of compatibility utilities were removed from `sentry_sdk._compat`: the constants `PY2` and `PY33`; the functions `datetime_utcnow`, `utc_from_timestamp`, `implements_str`, `contextmanager`; and the aliases `text_type`, `string_types`, `number_types`, `int_types`, `iteritems`, `binary_sequence_types`.
23+
- The deprecated `with_locals` configuration option was removed. Use `include_local_variables` instead. See https://docs.sentry.io/platforms/python/configuration/options/#include-local-variables.
24+
- The deprecated `request_bodies` configuration option was removed. Use `max_request_body_size`. See https://docs.sentry.io/platforms/python/configuration/options/#max-request-body-size.
2325
- Removed `sentry_sdk.utils.Auth.store_api_url`.
2426
- `sentry_sdk.utils.Auth.get_api_url`'s now accepts a `sentry_sdk.consts.EndpointType` enum instead of a string as its only parameter. We recommend omitting this argument when calling the function, since the parameter's default value is the only possible `sentry_sdk.consts.EndpointType` value. The parameter exists for future compatibility.
2527
- Removed `tracing_utils_py2.py`. The `start_child_span_decorator` is now in `sentry_sdk.tracing_utils`.
28+
- Removed support for the `install` method for custom integrations. Please use `setup_once` instead.
29+
- Removed `sentry_sdk.tracing.Span.new_span`. Use `sentry_sdk.tracing.Span.start_child` instead.
30+
- Removed `sentry_sdk.tracing.Transaction.new_span`. Use `sentry_sdk.tracing.Transaction.start_child` instead.
2631

2732
## Deprecated
2833

sentry_sdk/client.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -80,26 +80,6 @@ def _get_options(*args, **kwargs):
8080

8181
for key, value in options.items():
8282
if key not in rv:
83-
# Option "with_locals" was renamed to "include_local_variables"
84-
if key == "with_locals":
85-
msg = (
86-
"Deprecated: The option 'with_locals' was renamed to 'include_local_variables'. "
87-
"Please use 'include_local_variables'. The option 'with_locals' will be removed in the future."
88-
)
89-
logger.warning(msg)
90-
rv["include_local_variables"] = value
91-
continue
92-
93-
# Option "request_bodies" was renamed to "max_request_body_size"
94-
if key == "request_bodies":
95-
msg = (
96-
"Deprecated: The option 'request_bodies' was renamed to 'max_request_body_size'. "
97-
"Please use 'max_request_body_size'. The option 'request_bodies' will be removed in the future."
98-
)
99-
logger.warning(msg)
100-
rv["max_request_body_size"] = value
101-
continue
102-
10383
raise TypeError("Unknown option %r" % (key,))
10484

10585
rv[key] = value

sentry_sdk/integrations/__init__.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,6 @@ def setup_integrations(
143143
)
144144
try:
145145
type(integration).setup_once()
146-
except NotImplementedError:
147-
if getattr(integration, "install", None) is not None:
148-
logger.warning(
149-
"Integration %s: The install method is "
150-
"deprecated. Use `setup_once`.",
151-
identifier,
152-
)
153-
integration.install() # type: ignore
154-
else:
155-
raise
156146
except DidNotEnable as e:
157147
if identifier not in used_as_default_integration:
158148
raise

sentry_sdk/tracing.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -263,14 +263,6 @@ def start_child(self, instrumenter=INSTRUMENTER.SENTRY, **kwargs):
263263

264264
return child
265265

266-
def new_span(self, **kwargs):
267-
# type: (**Any) -> Span
268-
"""DEPRECATED: use :py:meth:`sentry_sdk.tracing.Span.start_child` instead."""
269-
logger.warning(
270-
"Deprecated: use Span.start_child instead of Span.new_span. This will be removed in the future."
271-
)
272-
return self.start_child(**kwargs)
273-
274266
@classmethod
275267
def continue_from_environ(
276268
cls,
@@ -917,10 +909,6 @@ def start_child(self, instrumenter=INSTRUMENTER.SENTRY, **kwargs):
917909
# type: (str, **Any) -> NoOpSpan
918910
return NoOpSpan()
919911

920-
def new_span(self, **kwargs):
921-
# type: (**Any) -> NoOpSpan
922-
return self.start_child(**kwargs)
923-
924912
def to_traceparent(self):
925913
# type: () -> str
926914
return ""

tests/test_client.py

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
)
2222
from sentry_sdk.integrations.executing import ExecutingIntegration
2323
from sentry_sdk.transport import Transport
24-
from sentry_sdk.utils import logger
2524
from sentry_sdk.serializer import MAX_DATABAG_BREADTH
2625
from sentry_sdk.consts import DEFAULT_MAX_BREADCRUMBS, DEFAULT_MAX_VALUE_LENGTH
2726
from sentry_sdk._types import TYPE_CHECKING
@@ -368,60 +367,6 @@ def e(exc):
368367
)
369368

370369

371-
def test_with_locals_deprecation_enabled(sentry_init):
372-
with mock.patch.object(logger, "warning", mock.Mock()) as fake_warning:
373-
sentry_init(with_locals=True)
374-
375-
client = Hub.current.client
376-
assert "with_locals" not in client.options
377-
assert "include_local_variables" in client.options
378-
assert client.options["include_local_variables"]
379-
380-
fake_warning.assert_called_once_with(
381-
"Deprecated: The option 'with_locals' was renamed to 'include_local_variables'. Please use 'include_local_variables'. The option 'with_locals' will be removed in the future."
382-
)
383-
384-
385-
def test_with_locals_deprecation_disabled(sentry_init):
386-
with mock.patch.object(logger, "warning", mock.Mock()) as fake_warning:
387-
sentry_init(with_locals=False)
388-
389-
client = Hub.current.client
390-
assert "with_locals" not in client.options
391-
assert "include_local_variables" in client.options
392-
assert not client.options["include_local_variables"]
393-
394-
fake_warning.assert_called_once_with(
395-
"Deprecated: The option 'with_locals' was renamed to 'include_local_variables'. Please use 'include_local_variables'. The option 'with_locals' will be removed in the future."
396-
)
397-
398-
399-
def test_include_local_variables_deprecation(sentry_init):
400-
with mock.patch.object(logger, "warning", mock.Mock()) as fake_warning:
401-
sentry_init(include_local_variables=False)
402-
403-
client = Hub.current.client
404-
assert "with_locals" not in client.options
405-
assert "include_local_variables" in client.options
406-
assert not client.options["include_local_variables"]
407-
408-
fake_warning.assert_not_called()
409-
410-
411-
def test_request_bodies_deprecation(sentry_init):
412-
with mock.patch.object(logger, "warning", mock.Mock()) as fake_warning:
413-
sentry_init(request_bodies="small")
414-
415-
client = Hub.current.client
416-
assert "request_bodies" not in client.options
417-
assert "max_request_body_size" in client.options
418-
assert client.options["max_request_body_size"] == "small"
419-
420-
fake_warning.assert_called_once_with(
421-
"Deprecated: The option 'request_bodies' was renamed to 'max_request_body_size'. Please use 'max_request_body_size'. The option 'request_bodies' will be removed in the future."
422-
)
423-
424-
425370
def test_include_local_variables_enabled(sentry_init, capture_events):
426371
sentry_init(include_local_variables=True)
427372
events = capture_events()

0 commit comments

Comments
 (0)