File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed 
instrumentation/opentelemetry-instrumentation-fastapi/tests Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -1929,6 +1929,22 @@ async def _():
19291929        self .assertIsNotNone (self .request_trace_id )
19301930        self .assertEqual (self .request_trace_id , self .error_trace_id )
19311931
1932+         spans  =  self .memory_exporter .get_finished_spans ()
1933+ 
1934+         self .assertEqual (len (spans ), 1 )
1935+         span  =  spans [0 ]
1936+         self .assertEqual (span .status .status_code , StatusCode .ERROR )
1937+         self .assertEqual (
1938+             len (span .events ), 2 
1939+         )  # The other span is a `TypeError` from the exception handler not returning a proper response, that's expected 
1940+         event  =  span .events [0 ]
1941+         self .assertEqual (event .name , "exception" )
1942+         assert  event .attributes  is  not   None 
1943+         self .assertEqual (
1944+             event .attributes .get (EXCEPTION_TYPE ),
1945+             f"{ __name__ }  .UnhandledException" ,
1946+         )
1947+ 
19321948    def  test_error_handler_side_effects (self ):
19331949        """FastAPI default exception handlers (aka error handlers) must be executed exactly once per exception""" 
19341950
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments