From 7bd29f86ebec4343d4a564be6450b724e726c3a9 Mon Sep 17 00:00:00 2001 From: Pablo Deputter Date: Thu, 24 Sep 2026 15:14:16 +0200 Subject: [PATCH 1/3] ref(dramatiq): Drop `send_default_pii` support --- sentry_sdk/integrations/dramatiq.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sentry_sdk/integrations/dramatiq.py b/sentry_sdk/integrations/dramatiq.py index 2ac023bb63..baf0ceb82f 100644 --- a/sentry_sdk/integrations/dramatiq.py +++ b/sentry_sdk/integrations/dramatiq.py @@ -15,7 +15,6 @@ AnnotatedValue, capture_internal_exceptions, event_from_exception, - has_data_collection_enabled, parse_version, ) @@ -226,11 +225,9 @@ def extract_into_event(self, event: "Event") -> None: request_info = contexts.setdefault("dramatiq", {}) request_info["type"] = "dramatiq" - attach_request_body = True - if has_data_collection_enabled(client.options): - attach_request_body = ( - "incoming_request" in client.options["data_collection"]["http_bodies"] - ) + attach_request_body = ( + "incoming_request" in client.options["data_collection"]["http_bodies"] + ) if attach_request_body: data: "Optional[Union[AnnotatedValue, Dict[str, Any]]]" = None From 27244d4623912d04e0ba1de36717a96f03b6d75d Mon Sep 17 00:00:00 2001 From: Pablo Deputter Date: Thu, 24 Sep 2026 15:17:59 +0200 Subject: [PATCH 2/3] tests --- tests/integrations/dramatiq/test_dramatiq.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/integrations/dramatiq/test_dramatiq.py b/tests/integrations/dramatiq/test_dramatiq.py index 31577cd621..6b0c91a672 100644 --- a/tests/integrations/dramatiq/test_dramatiq.py +++ b/tests/integrations/dramatiq/test_dramatiq.py @@ -355,6 +355,7 @@ def dummy_actor(x, y): True, ], ) +@pytest.mark.parametrize("broker", [{"data_collection": {}}], indirect=True) def test_that_message_data_is_added_as_request( broker, worker, capture_events, fail_fast ): @@ -394,7 +395,7 @@ def dummy_actor(x, y): @pytest.mark.parametrize( "broker,expect_message_data", [ - pytest.param({}, True, id="data_collection_not_enabled"), + pytest.param({"data_collection": {}}, True, id="data_collection_default"), pytest.param( {"data_collection": {"http_bodies": ["incoming_request"]}}, True, From 5523f1587c4a98beef126b500375e0600a47237b Mon Sep 17 00:00:00 2001 From: Pablo Deputter Date: Thu, 24 Sep 2026 15:45:59 +0200 Subject: [PATCH 3/3] fix(dramatiq): gate message data with queue collection --- sentry_sdk/integrations/dramatiq.py | 6 +----- tests/integrations/dramatiq/test_dramatiq.py | 15 ++++++++++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/sentry_sdk/integrations/dramatiq.py b/sentry_sdk/integrations/dramatiq.py index baf0ceb82f..615fb18668 100644 --- a/sentry_sdk/integrations/dramatiq.py +++ b/sentry_sdk/integrations/dramatiq.py @@ -225,11 +225,7 @@ def extract_into_event(self, event: "Event") -> None: request_info = contexts.setdefault("dramatiq", {}) request_info["type"] = "dramatiq" - attach_request_body = ( - "incoming_request" in client.options["data_collection"]["http_bodies"] - ) - - if attach_request_body: + if client.options["data_collection"]["queues"]: data: "Optional[Union[AnnotatedValue, Dict[str, Any]]]" = None if not request_body_within_bounds(client, self.content_length()): data = AnnotatedValue.removed_because_over_size_limit() diff --git a/tests/integrations/dramatiq/test_dramatiq.py b/tests/integrations/dramatiq/test_dramatiq.py index 6b0c91a672..64917dcf60 100644 --- a/tests/integrations/dramatiq/test_dramatiq.py +++ b/tests/integrations/dramatiq/test_dramatiq.py @@ -397,14 +397,19 @@ def dummy_actor(x, y): [ pytest.param({"data_collection": {}}, True, id="data_collection_default"), pytest.param( - {"data_collection": {"http_bodies": ["incoming_request"]}}, + {"data_collection": {"queues": True}}, True, - id="data_collection_http_bodies_incoming_request", + id="data_collection_queues_on", ), pytest.param( - {"data_collection": {"http_bodies": []}}, + {"data_collection": {"queues": False}}, False, - id="data_collection_http_bodies_empty", + id="data_collection_queues_off", + ), + pytest.param( + {"data_collection": {"queues": True, "http_bodies": []}}, + True, + id="data_collection_queues_independent_of_http_bodies", ), ], indirect=["broker"], @@ -434,7 +439,7 @@ def dummy_actor(x, y): @pytest.mark.parametrize( "broker", - [{"data_collection": {"http_bodies": []}}], + [{"data_collection": {"queues": False}}], indirect=True, ) def test_that_dramatiq_context_type_is_set_regardless_of_data_collection(