Skip to content

Commit 4a2e6e7

Browse files
szokeasaurusrexsentrivana
authored andcommitted
feat(transport): Remove HttpTransport hub_cls attribute (#3412)
This change is a prerequisite for #3404. BREAKING CHANGE: Remove `sentry_sdk.transport.HttpTransport`'s `hub_cls` attribute.
1 parent 735513e commit 4a2e6e7

File tree

2 files changed

+0
-48
lines changed

2 files changed

+0
-48
lines changed

sentry_sdk/transport.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import urllib3
1313
import certifi
1414

15-
import sentry_sdk
1615
from sentry_sdk.consts import EndpointType
1716
from sentry_sdk.utils import Dsn, logger, capture_internal_exceptions
1817
from sentry_sdk.worker import BackgroundWorker
@@ -231,9 +230,6 @@ def __init__(
231230
proxy_headers=options["proxy_headers"],
232231
)
233232

234-
# Backwards compatibility for deprecated `self.hub_class` attribute
235-
self._hub_cls = sentry_sdk.Hub
236-
237233
def record_lost_event(
238234
self,
239235
reason, # type: str
@@ -604,30 +600,6 @@ def kill(self):
604600
logger.debug("Killing HTTP transport")
605601
self._worker.kill()
606602

607-
@staticmethod
608-
def _warn_hub_cls():
609-
# type: () -> None
610-
"""Convenience method to warn users about the deprecation of the `hub_cls` attribute."""
611-
warnings.warn(
612-
"The `hub_cls` attribute is deprecated and will be removed in a future release.",
613-
DeprecationWarning,
614-
stacklevel=3,
615-
)
616-
617-
@property
618-
def hub_cls(self):
619-
# type: () -> type[sentry_sdk.Hub]
620-
"""DEPRECATED: This attribute is deprecated and will be removed in a future release."""
621-
HttpTransport._warn_hub_cls()
622-
return self._hub_cls
623-
624-
@hub_cls.setter
625-
def hub_cls(self, value):
626-
# type: (type[sentry_sdk.Hub]) -> None
627-
"""DEPRECATED: This attribute is deprecated and will be removed in a future release."""
628-
HttpTransport._warn_hub_cls()
629-
self._hub_cls = value
630-
631603

632604
class _FunctionTransport(Transport):
633605
"""

tests/test_transport.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,11 @@
1818
capture_message,
1919
isolation_scope,
2020
get_isolation_scope,
21-
Hub,
2221
)
2322
from sentry_sdk.envelope import Envelope, Item, parse_json
2423
from sentry_sdk.transport import (
2524
KEEP_ALIVE_SOCKET_OPTIONS,
2625
_parse_rate_limits,
27-
HttpTransport,
2826
)
2927
from sentry_sdk.integrations.logging import LoggingIntegration, ignore_logger
3028

@@ -649,24 +647,6 @@ def test_metric_bucket_limits_with_all_namespaces(
649647
]
650648

651649

652-
def test_hub_cls_backwards_compat():
653-
class TestCustomHubClass(Hub):
654-
pass
655-
656-
transport = HttpTransport(
657-
defaultdict(lambda: None, {"dsn": "https://123abc@example.com/123"})
658-
)
659-
660-
with pytest.deprecated_call():
661-
assert transport.hub_cls is Hub
662-
663-
with pytest.deprecated_call():
664-
transport.hub_cls = TestCustomHubClass
665-
666-
with pytest.deprecated_call():
667-
assert transport.hub_cls is TestCustomHubClass
668-
669-
670650
@pytest.mark.parametrize("quantity", (1, 2, 10))
671651
def test_record_lost_event_quantity(capturing_server, make_client, quantity):
672652
client = make_client()

0 commit comments

Comments
 (0)