24
24
from opentelemetry .sdk .trace .export import SpanExportResult
25
25
from opentelemetry .sdk .util .instrumentation import InstrumentationInfo
26
26
from opentelemetry .trace import TraceFlags
27
+ from opentelemetry .trace .status import Status , StatusCanonicalCode
27
28
28
29
29
30
class MockResponse :
@@ -174,6 +175,9 @@ def test_export(self):
174
175
otel_spans [0 ].set_attribute ("key_bool" , False )
175
176
otel_spans [0 ].set_attribute ("key_string" , "hello_world" )
176
177
otel_spans [0 ].set_attribute ("key_float" , 111.22 )
178
+ otel_spans [0 ].set_status (
179
+ Status (StatusCanonicalCode .UNKNOWN , "Example description" )
180
+ )
177
181
otel_spans [0 ].end (end_time = end_times [0 ])
178
182
179
183
otel_spans [1 ].start (start_time = start_times [1 ])
@@ -213,6 +217,8 @@ def test_export(self):
213
217
"key_bool" : "False" ,
214
218
"key_string" : "hello_world" ,
215
219
"key_float" : "111.22" ,
220
+ "otel.status_code" : 2 ,
221
+ "otel.status_description" : "Example description" ,
216
222
},
217
223
"annotations" : [
218
224
{
@@ -231,7 +237,10 @@ def test_export(self):
231
237
"duration" : durations [1 ] // 10 ** 3 ,
232
238
"localEndpoint" : local_endpoint ,
233
239
"kind" : None ,
234
- "tags" : {"key_resource" : "some_resource" },
240
+ "tags" : {
241
+ "key_resource" : "some_resource" ,
242
+ "otel.status_code" : 0 ,
243
+ },
235
244
"annotations" : None ,
236
245
},
237
246
{
@@ -245,6 +254,7 @@ def test_export(self):
245
254
"tags" : {
246
255
"key_string" : "hello_world" ,
247
256
"key_resource" : "some_resource" ,
257
+ "otel.status_code" : 0 ,
248
258
},
249
259
"annotations" : None ,
250
260
},
@@ -259,6 +269,7 @@ def test_export(self):
259
269
"tags" : {
260
270
"otel.instrumentation_library.name" : "name" ,
261
271
"otel.instrumentation_library.version" : "version" ,
272
+ "otel.status_code" : 0 ,
262
273
},
263
274
"annotations" : None ,
264
275
},
@@ -324,7 +335,7 @@ def test_zero_padding(self):
324
335
"duration" : duration // 10 ** 3 ,
325
336
"localEndpoint" : local_endpoint ,
326
337
"kind" : None ,
327
- "tags" : {},
338
+ "tags" : {"otel.status_code" : 0 },
328
339
"annotations" : None ,
329
340
"debug" : True ,
330
341
"parentId" : "0aaaaaaaaaaaaaaa" ,
0 commit comments