diff --git a/sentry_sdk/integrations/huey.py b/sentry_sdk/integrations/huey.py index 7cfbcc2022..409fad491c 100644 --- a/sentry_sdk/integrations/huey.py +++ b/sentry_sdk/integrations/huey.py @@ -6,7 +6,6 @@ from sentry_sdk.api import get_baggage, get_traceparent from sentry_sdk.consts import OP, SPANDATA from sentry_sdk.integrations import DidNotEnable, Integration, _check_minimum_version -from sentry_sdk.scope import should_send_default_pii from sentry_sdk.traces import ( BAGGAGE_HEADER_NAME, SENTRY_TRACE_HEADER_NAME, @@ -15,12 +14,10 @@ SpanStatus, ) from sentry_sdk.utils import ( - SENSITIVE_DATA_SUBSTITUTE, _register_control_flow_exception, capture_internal_exceptions, ensure_integration_enabled, event_from_exception, - has_data_collection_enabled, parse_version, reraise, ) @@ -132,16 +129,9 @@ def event_processor(event: "Event", hint: "Hint") -> "Optional[Event]": } client_options = sentry_sdk.get_client().options - if has_data_collection_enabled(client_options): - if client_options["data_collection"]["queues"]: - huey_job["args"] = task.args - huey_job["kwargs"] = task.kwargs - elif should_send_default_pii(): + if client_options["data_collection"]["queues"]: huey_job["args"] = task.args huey_job["kwargs"] = task.kwargs - else: - huey_job["args"] = SENSITIVE_DATA_SUBSTITUTE - huey_job["kwargs"] = SENSITIVE_DATA_SUBSTITUTE extra["huey-job"] = huey_job diff --git a/tests/integrations/huey/test_huey.py b/tests/integrations/huey/test_huey.py index 5c37081cc4..113d6a2025 100644 --- a/tests/integrations/huey/test_huey.py +++ b/tests/integrations/huey/test_huey.py @@ -10,7 +10,7 @@ from sentry_sdk.integrations.huey import HueyIntegration from sentry_sdk.traces import SegmentNameSource, SpanStatus from sentry_sdk.utils import parse_version -from tests.integrations.utils import DATA_COLLECTION_QUEUES_CASES_LEGACY +from tests.integrations.utils import DATA_COLLECTION_QUEUES_CASES HUEY_VERSION = parse_version(HUEY_VERSION) @@ -23,13 +23,13 @@ @pytest.fixture def init_huey(sentry_init): - def inner(init_kwargs=None): + def inner(data_collection=None): sentry_init_kwargs = { "integrations": [HueyIntegration()], "traces_sample_rate": 1.0, - "send_default_pii": True, } - sentry_init_kwargs.update(init_kwargs or {}) + if data_collection is not None: + sentry_init_kwargs["data_collection"] = data_collection sentry_init(**sentry_init_kwargs) return MemoryHuey(name="sentry_sdk") @@ -204,17 +204,17 @@ def maybe_locked_task(): @pytest.mark.parametrize( - "init_kwargs,expected_args,expected_kwargs", - DATA_COLLECTION_QUEUES_CASES_LEGACY, + "data_collection,expected_args,expected_kwargs", + DATA_COLLECTION_QUEUES_CASES, ) def test_task_args_kwargs_data_collection( capture_items, init_huey, - init_kwargs, + data_collection, expected_args, expected_kwargs, ): - huey = init_huey(init_kwargs=init_kwargs) + huey = init_huey(data_collection=data_collection) @huey.task() def division(a, b):