Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions sentry_sdk/integrations/huey.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
)
Expand Down Expand Up @@ -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

Expand Down
16 changes: 8 additions & 8 deletions tests/integrations/huey/test_huey.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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")
Expand Down Expand Up @@ -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):
Expand Down
Loading