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 <balsini@google.com>
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index 27c4f4e..6e80ffd 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -392,6 +392,7 @@
WifiFailureStatReported wifi_failure_stat_reported = 252 [(module) = "wifi"];
WifiConnectionResultReported wifi_connection_result_reported = 253 [(module) = "wifi"];
AppFreezeChanged app_freeze_changed = 254 [(module) = "framework"];
+ SnapshotMergeReported snapshot_merge_reported = 255;
SdkExtensionStatus sdk_extension_status = 354;
}
@@ -4403,6 +4404,52 @@
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 //
//////////////////////////////////////////////////////////////////////