File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -145,8 +145,17 @@ def trace_stream_guard(
145145            res  =  next (result )  # type: ignore 
146146            # FIXME: This should only be called once; 
147147            # Accumulate the validated output and call at the end 
148-             add_guard_attributes (guard_span , history , res )
149-             add_user_attributes (guard_span )
148+             if  not  guard_span .is_recording ():
149+                 # Assuming you have a tracer instance 
150+                 tracer  =  get_tracer (__name__ )
151+                 # Create a new span and link it to the previous span 
152+                 with  tracer .start_as_current_span (
153+                     "new_guard_span" ,  # type: ignore 
154+                     links = [Link (guard_span .get_span_context ())],
155+                 ) as  new_span :
156+                     guard_span  =  new_span 
157+                     add_guard_attributes (guard_span , history , res )
158+                     add_user_attributes (guard_span )
150159            yield  res 
151160        except  StopIteration :
152161            next_exists  =  False 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments