File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 3333    "get_traceparent" ,
3434    "is_initialized" ,
3535    "isolation_scope" ,
36+     "last_event_id" ,
3637    "new_scope" ,
3738    "push_scope" ,
3839    "set_context" ,
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ def overload(x):
5959    "get_traceparent" ,
6060    "is_initialized" ,
6161    "isolation_scope" ,
62+     "last_event_id" ,
6263    "new_scope" ,
6364    "push_scope" ,
6465    "set_context" ,
@@ -332,6 +333,12 @@ def start_transaction(
332333    )
333334
334335
336+ @scopemethod  
337+ def  last_event_id ():
338+     # type: () -> Optional[str] 
339+     return  Scope .last_event_id ()
340+ 
341+ 
335342def  set_measurement (name , value , unit = "" ):
336343    # type: (str, float, MeasurementUnit) -> None 
337344    transaction  =  Scope .get_current_scope ().transaction 
Original file line number Diff line number Diff line change 1515    capture_exception ,
1616    capture_message ,
1717    start_transaction ,
18+     last_event_id ,
1819    add_breadcrumb ,
1920    Hub ,
2021    Scope ,
@@ -778,3 +779,24 @@ def test_classmethod_tracing(sentry_init):
778779        with  patch_start_tracing_child () as  fake_start_child :
779780            assert  instance_or_class .class_ (1 ) ==  (TracingTestClass , 1 )
780781            assert  fake_start_child .call_count  ==  1 
782+ 
783+ 
784+ def  test_last_event_id (sentry_init ):
785+     sentry_init (enable_tracing = True )
786+ 
787+     assert  last_event_id () is  None 
788+ 
789+     capture_exception (Exception ("test" ))
790+ 
791+     assert  last_event_id () is  not None 
792+ 
793+ 
794+ def  test_last_event_id_transaction (sentry_init ):
795+     sentry_init (enable_tracing = True )
796+ 
797+     assert  last_event_id () is  None 
798+ 
799+     with  start_transaction (name = "test" ):
800+         pass 
801+ 
802+     assert  last_event_id () is  None , "Transaction should not set last_event_id" 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments