@@ -248,7 +248,7 @@ def _traced_execute_command(
248248 span .set_attribute ("network.transport" , "unix" )
249249 if (
250250 args
251- and args [0 ] in ("EVALSHA" , "EVAL " )
251+ and args [0 ] in ("EVALSHA" , "FCALL " )
252252 and len (args ) > 1
253253 ):
254254 span .set_attribute ("db.stored_procedure.name" , args [1 ])
@@ -258,6 +258,10 @@ def _traced_execute_command(
258258 request_hook (span , instance , args , kwargs )
259259 try :
260260 response = func (* args , ** kwargs )
261+ except redis .WatchError as watch_exception :
262+ if span .is_recording ():
263+ span .set_status (StatusCode .UNSET )
264+ raise watch_exception
261265 except Exception as exc :
262266 if _report_new (semconv_opt_in_mode ) and span .is_recording ():
263267 error_type = getattr (exc , "args" , [None ])[0 ]
@@ -392,14 +396,18 @@ async def _async_traced_execute_command(
392396 span .set_attribute ("network.transport" , "unix" )
393397 if (
394398 args
395- and args [0 ] in ("EVALSHA" , "EVAL " )
399+ and args [0 ] in ("EVALSHA" , "FCALL " )
396400 and len (args ) > 1
397401 ):
398402 span .set_attribute ("db.stored_procedure.name" , args [1 ])
399403 if callable (request_hook ):
400404 request_hook (span , instance , args , kwargs )
401405 try :
402406 response = await func (* args , ** kwargs )
407+ except redis .WatchError as watch_exception :
408+ if span .is_recording ():
409+ span .set_status (StatusCode .UNSET )
410+ raise watch_exception
403411 except Exception as exc :
404412 if _report_new (semconv_opt_in_mode ) and span .is_recording ():
405413 error_type = getattr (exc , "args" , [None ])[0 ]
@@ -477,20 +485,25 @@ async def _async_traced_execute_pipeline(
477485 response = None
478486 try :
479487 response = await func (* args , ** kwargs )
488+ except redis .WatchError as watch_exception :
489+ if span .is_recording ():
490+ span .set_status (StatusCode .UNSET )
491+ exception = watch_exception
480492 except Exception as exc :
481- if _report_new (semconv_opt_in_mode ) and span .is_recording ():
482- error_type = getattr (exc , "args" , [None ])[0 ]
483- if error_type and isinstance (error_type , str ):
484- prefix = error_type .split (" " )[0 ]
485- span .set_attribute ("db.response.status_code" , prefix )
486- span .set_attribute ("error.type" , prefix )
487- else :
488- span .set_attribute (
489- "error.type" , type (exc ).__qualname__
490- )
491493 if span .is_recording ():
494+ if _report_new (semconv_opt_in_mode ):
495+ error_type = getattr (exc , "args" , [None ])[0 ]
496+ if error_type and isinstance (error_type , str ):
497+ prefix = error_type .split (" " )[0 ]
498+ span .set_attribute ("db.response.status_code" , prefix )
499+ span .set_attribute ("error.type" , prefix )
500+ else :
501+ span .set_attribute (
502+ "error.type" , type (exc ).__qualname__
503+ )
492504 span .set_status (StatusCode .ERROR )
493- raise
505+ exception = exc
506+
494507 if callable (response_hook ):
495508 response_hook (span , instance , response )
496509
0 commit comments