@@ -92,6 +92,35 @@ def test_task(self):
92
92
self .assertEqual (consumer .parent .span_id , producer .context .span_id )
93
93
self .assertEqual (consumer .context .trace_id , producer .context .trace_id )
94
94
95
+ def test_queue_name (self ):
96
+ CeleryInstrumentor ().instrument ()
97
+
98
+ result = task_add .delay (1 , 2 )
99
+
100
+ timeout = time .time () + 60 * 1 # 1 minutes from now
101
+ while not result .ready ():
102
+ if time .time () > timeout :
103
+ break
104
+ time .sleep (0.05 )
105
+
106
+ spans = self .sorted_spans (self .memory_exporter .get_finished_spans ())
107
+ self .assertEqual (len (spans ), 2 )
108
+
109
+ consumer , producer = spans
110
+
111
+ self .assertEqual (consumer .name , "run/tests.celery_test_tasks.task_add" )
112
+ self .assertEqual (consumer .kind , SpanKind .CONSUMER )
113
+ self .assertSpanHasAttributes (
114
+ consumer ,
115
+ {
116
+ "celery.action" : "run" ,
117
+ "celery.state" : "SUCCESS" ,
118
+ SpanAttributes .MESSAGING_DESTINATION : "celery" ,
119
+ SpanAttributes .MESSAGING_SYSTEM : "celery" ,
120
+ "celery.task_name" : "tests.celery_test_tasks.task_add" ,
121
+ },
122
+ )
123
+
95
124
def test_task_raises (self ):
96
125
CeleryInstrumentor ().instrument ()
97
126
0 commit comments