File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55import sentry_sdk
66from sentry_sdk .api import continue_trace , get_baggage , get_traceparent
7- from sentry_sdk .consts import OP , SPANSTATUS
7+ from sentry_sdk .consts import OP , SPANDATA , SPANSTATUS
88from sentry_sdk .integrations import DidNotEnable , Integration
99from sentry_sdk .scope import should_send_default_pii
1010from sentry_sdk .traces import SegmentSource , SpanStatus , StreamedSpan
@@ -86,6 +86,7 @@ def _sentry_enqueue(
8686 attributes = {
8787 "sentry.op" : OP .QUEUE_SUBMIT_HUEY ,
8888 "sentry.origin" : HueyIntegration .origin ,
89+ SPANDATA .MESSAGING_DESTINATION_NAME : self .name ,
8990 },
9091 )
9192 else :
@@ -94,6 +95,7 @@ def _sentry_enqueue(
9495 name = span_name ,
9596 origin = HueyIntegration .origin ,
9697 )
98+ span_ctx .set_data (SPANDATA .MESSAGING_DESTINATION_NAME , self .name )
9799
98100 no_headers_types = (PeriodicTask ,) + tuple (
99101 t for t in [HueyGroup , HueyChord ] if t is not None
Original file line number Diff line number Diff line change 77
88import sentry_sdk
99from sentry_sdk import start_transaction
10- from sentry_sdk .consts import OP
10+ from sentry_sdk .consts import OP , SPANDATA
1111from sentry_sdk .integrations .huey import HueyIntegration
1212from sentry_sdk .traces import SegmentSource , SpanStatus
1313from sentry_sdk .utils import parse_version
@@ -97,6 +97,9 @@ def division(a, b):
9797 enqueue_span , execute_span = payloads
9898
9999 assert enqueue_span ["attributes" ]["sentry.op" ] == OP .QUEUE_SUBMIT_HUEY
100+ assert (
101+ enqueue_span ["attributes" ][SPANDATA .MESSAGING_DESTINATION_NAME ] == huey .name
102+ )
100103 assert execute_span ["is_segment" ]
101104 assert execute_span ["attributes" ]["sentry.op" ] == OP .QUEUE_TASK_HUEY
102105 assert execute_span ["name" ] == "division"
@@ -308,6 +311,7 @@ def dummy_task():
308311 assert len (event ["spans" ])
309312 assert event ["spans" ][0 ]["op" ] == "queue.submit.huey"
310313 assert event ["spans" ][0 ]["description" ] == "different_task_name"
314+ assert event ["spans" ][0 ]["data" ][SPANDATA .MESSAGING_DESTINATION_NAME ] == huey .name
311315
312316
313317def test_huey_propagate_trace (init_huey , capture_events ):
You can’t perform that action at this time.
0 commit comments