File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed
opentelemetry-instrumentation/src/opentelemetry/instrumentation Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -355,17 +355,16 @@ def _set_status(
355355 sem_conv_opt_in_mode ,
356356):
357357 if status_code < 0 :
358+ metrics_attributes [ERROR_TYPE ] = status_code_str
359+ if span .is_recording ():
358360 if _report_new (sem_conv_opt_in_mode ):
359- if span .is_recording ():
360- span .set_attribute (ERROR_TYPE , status_code_str )
361- metrics_attributes [ERROR_TYPE ] = status_code_str
362-
363- span .set_status (
364- Status (
365- StatusCode .ERROR ,
366- "Non-integer HTTP status: " + status_code_str ,
361+ span .set_attribute (ERROR_TYPE , status_code_str )
362+ span .set_status (
363+ Status (
364+ StatusCode .ERROR ,
365+ "Non-integer HTTP status: " + status_code_str ,
366+ )
367367 )
368- )
369368 else :
370369 status = http_status_to_status_code (status_code , server_span = True )
371370
@@ -381,7 +380,8 @@ def _set_status(
381380 if span .is_recording ():
382381 span .set_attribute (ERROR_TYPE , status_code_str )
383382 metrics_attributes [ERROR_TYPE ] = status_code_str
384- span .set_status (Status (status ))
383+ if span .is_recording ():
384+ span .set_status (Status (status ))
385385
386386
387387# Get schema version based off of opt-in mode
You can’t perform that action at this time.
0 commit comments