@@ -67,6 +67,7 @@ def test_task(self):
67
67
"celery.state" : "SUCCESS" ,
68
68
SpanAttributes .MESSAGING_DESTINATION : "celery" ,
69
69
"celery.task_name" : "tests.celery_test_tasks.task_add" ,
70
+ SpanAttributes .MESSAGING_SYSTEM : "celery" ,
70
71
},
71
72
)
72
73
@@ -85,49 +86,14 @@ def test_task(self):
85
86
"celery.task_name" : "tests.celery_test_tasks.task_add" ,
86
87
SpanAttributes .MESSAGING_DESTINATION_KIND : "queue" ,
87
88
SpanAttributes .MESSAGING_DESTINATION : "celery" ,
89
+ SpanAttributes .MESSAGING_SYSTEM : "celery" ,
88
90
},
89
91
)
90
92
91
93
self .assertNotEqual (consumer .parent , producer .context )
92
94
self .assertEqual (consumer .parent .span_id , producer .context .span_id )
93
95
self .assertEqual (consumer .context .trace_id , producer .context .trace_id )
94
96
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_SYSTEM : "celery" ,
119
- "celery.task_name" : "tests.celery_test_tasks.task_add" ,
120
- },
121
- )
122
- self .assertSpanHasAttributes (
123
- producer ,
124
- {
125
- "celery.action" : "apply_async" ,
126
- "celery.task_name" : "tests.celery_test_tasks.task_add" ,
127
- SpanAttributes .MESSAGING_SYSTEM : "celery" ,
128
- },
129
- )
130
-
131
97
def test_task_raises (self ):
132
98
CeleryInstrumentor ().instrument ()
133
99
@@ -155,6 +121,7 @@ def test_task_raises(self):
155
121
"celery.state" : "FAILURE" ,
156
122
SpanAttributes .MESSAGING_DESTINATION : "celery" ,
157
123
"celery.task_name" : "tests.celery_test_tasks.task_raises" ,
124
+ SpanAttributes .MESSAGING_SYSTEM : "celery" ,
158
125
},
159
126
)
160
127
@@ -186,6 +153,7 @@ def test_task_raises(self):
186
153
"celery.task_name" : "tests.celery_test_tasks.task_raises" ,
187
154
SpanAttributes .MESSAGING_DESTINATION_KIND : "queue" ,
188
155
SpanAttributes .MESSAGING_DESTINATION : "celery" ,
156
+ SpanAttributes .MESSAGING_SYSTEM : "celery" ,
189
157
},
190
158
)
191
159
0 commit comments