2222from ...utils .logger import Logger
2323from ...utils .no_build import NO_BUILD_BUILD_NAME , NO_BUILD_TEST_SESSION_ID
2424from ...utils .session import parse_session , read_build
25- from ..helper import find_or_create_session
25+ from ..helper import find_or_create_session , time_ns
2626from .case_event import CaseEvent , CaseEventType
2727
2828GROUP_NAME_RULE = re .compile ("^[a-zA-Z0-9][a-zA-Z0-9_-]*$" )
@@ -535,14 +535,24 @@ def recorded_result() -> Tuple[int, int, int, float]:
535535 return test_count , success_count , fail_count , duration / 60 # sec to min
536536
537537 try :
538+ start = time_ns ()
538539 tc = testcases (self .reports )
540+ end = time_ns ()
541+ tracking_client .send_event (
542+ event_name = Tracking .Event .PERFORMANCE ,
543+ metadata = {
544+ "elapsedTime" : end - start ,
545+ "measurementTarget" : "testcases method(parsing report file)"
546+ }
547+ )
539548
540549 if report_paths :
541550 # diagnostics mode to just report test paths
542551 for t in tc :
543552 print (unparse_test_path (t ['testPath' ]))
544553 return
545554
555+ start = time_ns ()
546556 exceptions = []
547557 for chunk in ichunked (tc , post_chunk ):
548558 p , es = payload (
@@ -555,6 +565,14 @@ def recorded_result() -> Tuple[int, int, int, float]:
555565
556566 send (p )
557567 exceptions .extend (es )
568+ end = time_ns ()
569+ tracking_client .send_event (
570+ event_name = Tracking .Event .PERFORMANCE ,
571+ metadata = {
572+ "elapsedTime" : end - start ,
573+ "measurementTarget" : "events API"
574+ }
575+ )
558576
559577 if len (exceptions ) > 0 :
560578 raise Exception (exceptions )
0 commit comments