update_engine: Add UMA stats for rollback
Adding the following UMA stats:
- UpdateEngine.Check.TargetVersion: first section of the Chrome OS
target version set by device policy. Sent during update checks if
target version policy is set.
- UpdateEngine.Check.RollbackTargetVersion: first section of the
Chrome OS target version if rollback is also allowed. Sent during
update checks if both policies are set.
- UpdateEngine.EnterpriseRollback.Success: first section of the
Chrome OS version to which rollback succeeded. Sent after
successful installation of the rollback image.
- UpdateEngine.EnterpriseRollback.Failure: first section of the
Chrome OS version to which rollback failed. Sent after
installation of the rollback image failed.
Chromium CL of the new histograms: crrev.com/c/1069129
BUG=chromium:843622
TEST='cros_run_unit_tests --board=caroline --packages update_engine'
Change-Id: I0b76fa286498ae0a1830a90034734ed9aa5efd3d
Reviewed-on: https://chromium-review.googlesource.com/1062033
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Marton Hunyady <hunyadym@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Jesse Doherty <jwd@chromium.org>
diff --git a/metrics_reporter_interface.h b/metrics_reporter_interface.h
index 13f5a54..8a7c864 100644
--- a/metrics_reporter_interface.h
+++ b/metrics_reporter_interface.h
@@ -18,6 +18,7 @@
#define UPDATE_ENGINE_METRICS_REPORTER_INTERFACE_H_
#include <memory>
+#include <string>
#include <base/time/time.h>
@@ -43,12 +44,20 @@
virtual void Initialize() = 0;
- // Helper function to report metrics related to rollback. The
+ // Helper function to report metrics related to user-initiated rollback. The
// following metrics are reported:
//
// |kMetricRollbackResult|
virtual void ReportRollbackMetrics(metrics::RollbackResult result) = 0;
+ // Helper function to report metrics related to enterprise (admin-initiated)
+ // rollback:
+ //
+ // |kMetricEnterpriseRollbackSuccess|
+ // |kMetricEnterpriseRollbackFailure|
+ virtual void ReportEnterpriseRollbackMetrics(
+ bool success, const std::string& rollback_version) = 0;
+
// Helper function to report metrics reported once a day. The
// following metrics are reported:
//
@@ -64,6 +73,8 @@
// |kMetricCheckDownloadErrorCode|
// |kMetricCheckTimeSinceLastCheckMinutes|
// |kMetricCheckTimeSinceLastCheckUptimeMinutes|
+ // |kMetricCheckTargetVersion|
+ // |kMetricCheckRollbackTargetVersion|
//
// The |kMetricCheckResult| metric will only be reported if |result|
// is not |kUnset|.
@@ -78,6 +89,10 @@
// |kMetricCheckTimeSinceLastCheckUptimeMinutes| metrics are
// automatically reported and calculated by maintaining persistent
// and process-local state variables.
+ //
+ // |kMetricCheckTargetVersion| reports the first section of the target version
+ // if it's set, |kMetricCheckRollbackTargetVersion| reports the same, but only
+ // if rollback is also allowed using enterprise policy.
virtual void ReportUpdateCheckMetrics(
SystemState* system_state,
metrics::CheckResult result,