From 66dec8428a87003e14732d59a47f7dbd47bc8b41 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Wed, 8 Jul 2026 11:39:00 +0200 Subject: [PATCH] feat(huey): Add messaging.destination.name attribute to producer spans --- sentry_sdk/integrations/huey.py | 4 +++- tests/integrations/huey/test_huey.py | 6 +++++- uv.lock | 3 --- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/sentry_sdk/integrations/huey.py b/sentry_sdk/integrations/huey.py index c3bbc8abcf..4023a7b56c 100644 --- a/sentry_sdk/integrations/huey.py +++ b/sentry_sdk/integrations/huey.py @@ -4,7 +4,7 @@ import sentry_sdk from sentry_sdk.api import continue_trace, get_baggage, get_traceparent -from sentry_sdk.consts import OP, SPANSTATUS +from sentry_sdk.consts import OP, SPANDATA, SPANSTATUS from sentry_sdk.integrations import DidNotEnable, Integration from sentry_sdk.scope import should_send_default_pii from sentry_sdk.traces import SegmentSource, SpanStatus, StreamedSpan @@ -86,6 +86,7 @@ def _sentry_enqueue( attributes={ "sentry.op": OP.QUEUE_SUBMIT_HUEY, "sentry.origin": HueyIntegration.origin, + SPANDATA.MESSAGING_DESTINATION_NAME: self.name, }, ) else: @@ -94,6 +95,7 @@ def _sentry_enqueue( name=span_name, origin=HueyIntegration.origin, ) + span_ctx.set_data(SPANDATA.MESSAGING_DESTINATION_NAME, self.name) no_headers_types = (PeriodicTask,) + tuple( t for t in [HueyGroup, HueyChord] if t is not None diff --git a/tests/integrations/huey/test_huey.py b/tests/integrations/huey/test_huey.py index 8cca10d54a..be9bc4458a 100644 --- a/tests/integrations/huey/test_huey.py +++ b/tests/integrations/huey/test_huey.py @@ -7,7 +7,7 @@ import sentry_sdk from sentry_sdk import start_transaction -from sentry_sdk.consts import OP +from sentry_sdk.consts import OP, SPANDATA from sentry_sdk.integrations.huey import HueyIntegration from sentry_sdk.traces import SegmentSource, SpanStatus from sentry_sdk.utils import parse_version @@ -97,6 +97,9 @@ def division(a, b): enqueue_span, execute_span = payloads assert enqueue_span["attributes"]["sentry.op"] == OP.QUEUE_SUBMIT_HUEY + assert ( + enqueue_span["attributes"][SPANDATA.MESSAGING_DESTINATION_NAME] == huey.name + ) assert execute_span["is_segment"] assert execute_span["attributes"]["sentry.op"] == OP.QUEUE_TASK_HUEY assert execute_span["name"] == "division" @@ -308,6 +311,7 @@ def dummy_task(): assert len(event["spans"]) assert event["spans"][0]["op"] == "queue.submit.huey" assert event["spans"][0]["description"] == "different_task_name" + assert event["spans"][0]["data"][SPANDATA.MESSAGING_DESTINATION_NAME] == huey.name def test_huey_propagate_trace(init_huey, capture_events): diff --git a/uv.lock b/uv.lock index 855c128ef8..fb1818bba8 100644 --- a/uv.lock +++ b/uv.lock @@ -6,9 +6,6 @@ resolution-markers = [ "python_full_version < '3.15'", ] -[options] -prerelease-mode = "allow" - [manifest] [manifest.dependency-groups]