Collect a DetectEvent when do index join
Test: atest atest_unittests
Change-Id: Ica56a4bdc01a447ac110ea18a680c63c2e27baca
diff --git a/atest/atest_enum.py b/atest/atest_enum.py
index 5118158..11a0b4c 100644
--- a/atest/atest_enum.py
+++ b/atest/atest_enum.py
@@ -21,7 +21,7 @@
@unique
class DetectType(IntEnum):
"""An Enum class for local_detect_event."""
- # Detect type for local_detect_event; next expansion: 51
+ # Detect type for local_detect_event; next expansion: 52
BUG_DETECTED = 0
ACLOUD_CREATE = 1
FIND_BUILD = 2
@@ -94,6 +94,8 @@
UPLOAD_FLOW_MS = 48
FETCH_CRED_MS = 49
UPLOAD_PREPARE_MS = 50
+ # Time of join the index.
+ IDX_JOIN_MS = 51
@unique
class ExitCode(IntEnum):
diff --git a/atest/atest_main.py b/atest/atest_main.py
index 6ece940..ddb6864 100755
--- a/atest/atest_main.py
+++ b/atest/atest_main.py
@@ -1118,8 +1118,12 @@
# (b/242567487) index_targets may finish after cli_translator; to
# mitigate the overhead, the main waits until it finished when no index
# files are available (e.g. fresh repo sync)
+ join_start = time.time()
if proc_idx and not atest_utils.has_index_files():
proc_idx.join()
+ metrics.LocalDetectEvent(
+ detect_type=DetectType.IDX_JOIN_MS,
+ result=int((time.time() - join_start) * 1000))
find_start = time.time()
test_infos = translator.translate(args)
given_amount = len(args.serial) if args.serial else 0