@@ -240,18 +240,14 @@ def dummy_task(x, y):
240240 assert error_event ["contexts" ]["trace" ]["trace_id" ] == span .trace_id
241241 assert error_event ["exception" ]["values" ][0 ]["type" ] == "ZeroDivisionError"
242242
243- span_items = [item .payload for item in items ]
244- process_span , execution_span , submit_span , submission_span = span_items
243+ process_span , execution_span , submit_span , submission_span = [
244+ item .payload for item in items
245+ ]
245246
246247 assert execution_span ["name" ] == "dummy_task"
248+ assert execution_span ["is_segment" ] is True
247249 assert execution_span ["attributes" ]["sentry.span.source" ] == "task"
248250 assert execution_span ["trace_id" ] == span .trace_id
249-
250- assert submit_span ["name" ] == "dummy_task"
251- assert submit_span ["trace_id" ] == span .trace_id
252- assert submit_span ["attributes" ]["sentry.origin" ] == "auto.queue.celery"
253- assert submit_span ["parent_span_id" ] == span .span_id
254-
255251 if task_fails :
256252 assert execution_span ["status" ] == "error"
257253 else :
@@ -260,6 +256,18 @@ def dummy_task(x, y):
260256 assert process_span ["name" ] == "dummy_task"
261257 assert process_span ["trace_id" ] == span .trace_id
262258 assert process_span ["attributes" ]["sentry.op" ] == "queue.process"
259+ assert process_span ["parent_span_id" ] == execution_span ["span_id" ]
260+
261+ assert submission_span ["name" ] == "submission"
262+ assert submission_span ["is_segment" ] is True
263+
264+ assert submit_span ["name" ] == "dummy_task"
265+ assert submit_span ["attributes" ]["sentry.op" ] == "queue.submit.celery"
266+ assert submit_span ["attributes" ]["sentry.origin" ] == "auto.queue.celery"
267+ assert (
268+ submit_span ["parent_span_id" ] == submission_span ["span_id" ] == span .span_id
269+ )
270+ assert submit_span ["trace_id" ] == span .trace_id
263271
264272 else :
265273 events = capture_events ()
0 commit comments