From 1550470660db35502db2e4a8280362d84e139799 Mon Sep 17 00:00:00 2001 From: Alessio Balsini Date: Wed, 15 Jan 2020 15:44:48 +0000 Subject: [PATCH] Extend atoms with Virtual A/B merge metrics With the Virtual A/B feature, when the device successfully boots after an OTA update, a dm-snapshot merge operation is performed, which consolidates the updated images to the base devices. This merge operation depends on the OTA size and may affect the device performance until completed. The new virtual_ab_update_reported push metric tracks the merge operation duration (if not interrupted), the final merge status and possible number of reboots that occurred during the merge. Bug: 138817833 Bug: 148138124 Test: build + OTA application + local metric test with statsd_testdrive Change-Id: Iabd1dc48ad0d737f6ed14caa247fd4952c65a258 Signed-off-by: Alessio Balsini Merged-In: Iabd1dc48ad0d737f6ed14caa247fd4952c65a258 --- cmds/statsd/src/atoms.proto | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto index 7a63493376e68..4f4a04e88964a 100644 --- a/cmds/statsd/src/atoms.proto +++ b/cmds/statsd/src/atoms.proto @@ -356,6 +356,7 @@ message Atom { BootTimeEventUtcTime boot_time_event_utc_time_reported = 241; BootTimeEventErrorCode boot_time_event_error_code_reported = 242; UserspaceRebootReported userspace_reboot_reported = 243 [(log_from_module) = "framework"]; + SnapshotMergeReported snapshot_merge_reported = 255; } // Pulled events will start at field 10000. @@ -3947,6 +3948,52 @@ message BootTimeEventErrorCode { optional int32 error_code = 2; } +/** + * Collects Virtual A/B statistics related to the use of dm-snapshot performed + * after an OTA. + * + * Logged from: + * - system/core/fs_mgr/libsnapshot/snapshot.cpp + * - system/core/fs_mgr/libsnapshot/snapshotctl.cpp + */ +message SnapshotMergeReported { + // Keep in sync with + // system/core/fs_mgr/libsnapshot/android/snapshot/snapshot.proto + enum UpdateState { + // No update or merge is in progress. + NONE = 0; + // An update is applying; snapshots may already exist. + INITIATED = 1; + // An update is pending, but has not been successfully booted yet. + UNVERIFIED = 2; + // The kernel is merging in the background. + MERGING = 3; + // Post-merge cleanup steps could not be completed due to a transient + // error, but the next reboot will finish any pending operations. + MERGE_NEEDS_REBOOT = 4; + // Merging is complete, and needs to be acknowledged. + MERGE_COMPLETED = 5; + // Merging failed due to an unrecoverable error. + MERGE_FAILED = 6; + // The update was implicitly cancelled, either by a rollback or a flash + // operation via fastboot. This state can only be returned by WaitForMerge. + CANCELLED = 7; + }; + + // Status of the update after the merge attempts. + optional UpdateState final_state = 1; + + // Time to complete a merge operation in milliseconds. + // A negative value corresponds to the case in which the merge operation + // was interrupted and resumed (e.g. in case of a system reboot during the + // merge). + optional int64 duration_millis = 2; + + // Number of reboots that occurred after issuing and before completing the + // merge of all the snapshot devices. + optional int32 intermediate_reboots = 3; +} + ////////////////////////////////////////////////////////////////////// // Pulled atoms below this line // //////////////////////////////////////////////////////////////////////