Index: components/policy/core/common/cloud/user_cloud_policy_store.cc |
diff --git a/components/policy/core/common/cloud/user_cloud_policy_store.cc b/components/policy/core/common/cloud/user_cloud_policy_store.cc |
index 3d298e6f0204e1c5fbb432089b1c696eb5ed7e9b..130055edf7dfd14e487008cf2121752560e69a10 100644 |
--- a/components/policy/core/common/cloud/user_cloud_policy_store.cc |
+++ b/components/policy/core/common/cloud/user_cloud_policy_store.cc |
@@ -18,6 +18,12 @@ namespace em = enterprise_management; |
namespace policy { |
+// This enum is used to define the buckets for an enumerated UMA histogram. |
+// Hence, |
+// (a) existing enumerated constants should never be deleted or reordered, and |
+// (b) new constants should only be appended at the end of the enumeration. |
+// |
+// Keep this in sync with EnterprisePolicyLoadStatus in histograms.xml. |
enum PolicyLoadStatus { |
// Policy blob was successfully loaded and parsed. |
LOAD_RESULT_SUCCESS, |
@@ -28,6 +34,11 @@ enum PolicyLoadStatus { |
// Could not load the previously stored policy due to either a parse or |
// file read error. |
LOAD_RESULT_LOAD_ERROR, |
+ |
+ // LOAD_RESULT_SIZE is the number of items in this enum and is used when |
+ // logging histograms to set the bucket size, so should always be the last |
+ // item. |
+ LOAD_RESULT_SIZE, |
}; |
// Struct containing the result of a policy load - if |status| == |
@@ -221,6 +232,9 @@ void UserCloudPolicyStore::Load() { |
void UserCloudPolicyStore::PolicyLoaded(bool validate_in_background, |
PolicyLoadResult result) { |
+ UMA_HISTOGRAM_ENUMERATION("Enterprise.UserCloudPolicyStore.LoadStatus", |
+ result.status, |
+ LOAD_RESULT_SIZE); |
switch (result.status) { |
case LOAD_RESULT_LOAD_ERROR: |
status_ = STATUS_LOAD_ERROR; |
@@ -274,6 +288,10 @@ void UserCloudPolicyStore::InstallLoadedPolicyAfterValidation( |
bool doing_key_rotation, |
const std::string& signing_key, |
UserCloudPolicyValidator* validator) { |
+ UMA_HISTOGRAM_ENUMERATION( |
+ "Enterprise.UserCloudPolicyStore.LoadValidationStatus", |
+ validator->status(), |
+ CloudPolicyValidatorBase::VALIDATION_STATUS_SIZE); |
validation_status_ = validator->status(); |
if (!validator->success()) { |
DVLOG(1) << "Validation failed: status=" << validation_status_; |
@@ -416,6 +434,10 @@ void UserCloudPolicyStore::Validate( |
void UserCloudPolicyStore::StorePolicyAfterValidation( |
UserCloudPolicyValidator* validator) { |
+ UMA_HISTOGRAM_ENUMERATION( |
+ "Enterprise.UserCloudPolicyStore.StoreValidationStatus", |
+ validator->status(), |
+ CloudPolicyValidatorBase::VALIDATION_STATUS_SIZE); |
validation_status_ = validator->status(); |
DVLOG(1) << "Policy validation complete: status = " << validation_status_; |
if (!validator->success()) { |