2424from opentelemetry .sdk .trace .export import SpanExportResult
2525from opentelemetry .sdk .util .instrumentation import InstrumentationInfo
2626from opentelemetry .trace import TraceFlags
27+ from opentelemetry .trace .status import Status , StatusCanonicalCode
2728
2829
2930class MockResponse :
@@ -174,6 +175,9 @@ def test_export(self):
174175 otel_spans [0 ].set_attribute ("key_bool" , False )
175176 otel_spans [0 ].set_attribute ("key_string" , "hello_world" )
176177 otel_spans [0 ].set_attribute ("key_float" , 111.22 )
178+ otel_spans [0 ].set_status (
179+ Status (StatusCanonicalCode .UNKNOWN , "Example description" )
180+ )
177181 otel_spans [0 ].end (end_time = end_times [0 ])
178182
179183 otel_spans [1 ].start (start_time = start_times [1 ])
@@ -213,6 +217,8 @@ def test_export(self):
213217 "key_bool" : "False" ,
214218 "key_string" : "hello_world" ,
215219 "key_float" : "111.22" ,
220+ "otel.status_code" : 2 ,
221+ "otel.status_description" : "Example description" ,
216222 },
217223 "annotations" : [
218224 {
@@ -231,7 +237,10 @@ def test_export(self):
231237 "duration" : durations [1 ] // 10 ** 3 ,
232238 "localEndpoint" : local_endpoint ,
233239 "kind" : None ,
234- "tags" : {"key_resource" : "some_resource" },
240+ "tags" : {
241+ "key_resource" : "some_resource" ,
242+ "otel.status_code" : 0 ,
243+ },
235244 "annotations" : None ,
236245 },
237246 {
@@ -245,6 +254,7 @@ def test_export(self):
245254 "tags" : {
246255 "key_string" : "hello_world" ,
247256 "key_resource" : "some_resource" ,
257+ "otel.status_code" : 0 ,
248258 },
249259 "annotations" : None ,
250260 },
@@ -259,6 +269,7 @@ def test_export(self):
259269 "tags" : {
260270 "otel.instrumentation_library.name" : "name" ,
261271 "otel.instrumentation_library.version" : "version" ,
272+ "otel.status_code" : 0 ,
262273 },
263274 "annotations" : None ,
264275 },
@@ -324,7 +335,7 @@ def test_zero_padding(self):
324335 "duration" : duration // 10 ** 3 ,
325336 "localEndpoint" : local_endpoint ,
326337 "kind" : None ,
327- "tags" : {},
338+ "tags" : {"otel.status_code" : 0 },
328339 "annotations" : None ,
329340 "debug" : True ,
330341 "parentId" : "0aaaaaaaaaaaaaaa" ,
0 commit comments