1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_ENTERPRISE_METRICS_H_ 6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_ENTERPRISE_METRICS_H_ 7 8 #include "components/policy/policy_export.h" 9 10 namespace policy { 11 12 // Metrics collected for enterprise events. 13 14 // Events related to fetching, saving and loading DM server tokens. 15 // These metrics are collected both for device and user tokens. 16 enum MetricToken { 17 // A cached token was successfully loaded from disk. 18 kMetricTokenLoadSucceeded, 19 // Reading a cached token from disk failed. 20 kMetricTokenLoadFailed, 21 22 // A token fetch request was sent to the DM server. 23 kMetricTokenFetchRequested, 24 // The request was invalid, or the HTTP request failed. 25 kMetricTokenFetchRequestFailed, 26 // Error HTTP status received, or the DM server failed in another way. 27 kMetricTokenFetchServerFailed, 28 // A response to the fetch request was received. 29 kMetricTokenFetchResponseReceived, 30 // The response received was invalid. This happens when some expected data 31 // was not present in the response. 32 kMetricTokenFetchBadResponse, 33 // DM server reported that management is not supported. 34 kMetricTokenFetchManagementNotSupported, 35 // DM server reported that the given device ID was not found. 36 kMetricTokenFetchDeviceNotFound, 37 // DM token successfully retrieved. 38 kMetricTokenFetchOK, 39 40 // Successfully cached a token to disk. 41 kMetricTokenStoreSucceeded, 42 // Caching a token to disk failed. 43 kMetricTokenStoreFailed, 44 45 // DM server reported that the device-id generated is not unique. 46 kMetricTokenFetchDeviceIdConflict, 47 // DM server reported that the serial number we try to register is invalid. 48 kMetricTokenFetchInvalidSerialNumber, 49 // DM server reported that the licenses for the domain have expired or been 50 // exhausted. 51 kMetricMissingLicenses, 52 53 kMetricTokenSize // Must be the last. 54 }; 55 56 // Events related to fetching, saving and loading user and device policies. 57 enum MetricPolicy { 58 // A cached policy was successfully loaded from disk. 59 kMetricPolicyLoadSucceeded, 60 // Reading a cached policy from disk failed. 61 kMetricPolicyLoadFailed, 62 63 // A policy fetch request was sent to the DM server. 64 kMetricPolicyFetchRequested, 65 // The request was invalid, or the HTTP request failed. 66 kMetricPolicyFetchRequestFailed, 67 // Error HTTP status received, or the DM server failed in another way. 68 kMetricPolicyFetchServerFailed, 69 // Policy not found for the given user or device. 70 kMetricPolicyFetchNotFound, 71 // DM server didn't accept the token used in the request. 72 kMetricPolicyFetchInvalidToken, 73 // A response to the policy fetch request was received. 74 kMetricPolicyFetchResponseReceived, 75 // The policy response message didn't contain a policy, or other data was 76 // missing. 77 kMetricPolicyFetchBadResponse, 78 // Failed to decode the policy. 79 kMetricPolicyFetchInvalidPolicy, 80 // The device policy was rejected because its signature was invalid. 81 kMetricPolicyFetchBadSignature, 82 // Rejected policy because its timestamp is in the future. 83 kMetricPolicyFetchTimestampInFuture, 84 // Device policy rejected because the device is not managed. 85 kMetricPolicyFetchNonEnterpriseDevice, 86 // The policy was provided for a username that is different from the device 87 // owner, and the policy was rejected. 88 kMetricPolicyFetchUserMismatch, 89 // The policy was rejected for another reason. Currently this can happen 90 // only for device policies, when the SignedSettings fail to store or retrieve 91 // a stored policy. 92 kMetricPolicyFetchOtherFailed, 93 // The fetched policy was accepted. 94 kMetricPolicyFetchOK, 95 // The policy just fetched didn't have any changes compared to the cached 96 // policy. 97 kMetricPolicyFetchNotModified, 98 99 // Successfully cached a policy to disk. 100 kMetricPolicyStoreSucceeded, 101 // Caching a policy to disk failed. 102 kMetricPolicyStoreFailed, 103 104 kMetricPolicySize // Must be the last. 105 }; 106 107 // Events related to device enrollment. 108 enum MetricEnrollment { 109 // The enrollment screen was closed without completing the enrollment 110 // process. 111 kMetricEnrollmentCancelled, 112 // The user submitted credentials and started the enrollment process. 113 kMetricEnrollmentStarted, 114 // Enrollment failed due to a network error. 115 kMetricEnrollmentNetworkFailed, 116 // Enrollment failed because logging in to Gaia failed. 117 kMetricEnrollmentLoginFailed, 118 // Enrollment failed because it is not supported for the account used. 119 kMetricEnrollmentNotSupported, 120 // Enrollment failed because it failed to apply device policy. 121 kMetricEnrollmentPolicyFailed, 122 // Enrollment failed due to an unexpected error. This currently happens when 123 // the Gaia auth token is not issued for the DM service, the device cloud 124 // policy subsystem isn't initialized, or when fetching Gaia tokens fails 125 // for an unknown reason. 126 kMetricEnrollmentOtherFailed, 127 // Enrollment was successful. 128 kMetricEnrollmentOK, 129 // Enrollment failed because the serial number we try to register is not 130 // assigned to the domain used. 131 kMetricEnrollmentInvalidSerialNumber, 132 // Auto-enrollment started automatically after the user signed in. 133 kMetricEnrollmentAutoStarted, 134 // Auto-enrollment failed. 135 kMetricEnrollmentAutoFailed, 136 // Auto-enrollment was retried after having failed before. 137 kMetricEnrollmentAutoRetried, 138 // Auto-enrollment was canceled through the opt-out dialog. 139 kMetricEnrollmentAutoCancelled, 140 // Auto-enrollment succeeded. 141 kMetricEnrollmentAutoOK, 142 // Enrollment failed because the enrollment mode was not supplied by the 143 // DMServer or the mode is not known to the client. 144 kMetricEnrollmentInvalidEnrollmentMode, 145 // Auto-enrollment is not supported for the mode supplied by the server. 146 // This presently means trying to auto-enroll in kiosk mode. 147 kMetricEnrollmentAutoEnrollmentNotSupported, 148 // The lockbox initialization has taken too long to complete and the 149 // enrollment has been canceled because of that. 150 kMetricLockboxTimeoutError, 151 // The username used to re-enroll the device does not belong to the domain 152 // that the device was initially enrolled to. 153 kMetricEnrollmentWrongUserError, 154 // DM server reported that the licenses for the domain has expired or been 155 // exhausted. 156 kMetricMissingLicensesError, 157 // Enrollment failed because the robot account auth code couldn't be 158 // fetched from the DM Server. 159 kMetricEnrollmentRobotAuthCodeFetchFailed, 160 // Enrollment failed because the robot account auth code couldn't be 161 // exchanged for a refresh token. 162 kMetricEnrollmentRobotRefreshTokenFetchFailed, 163 // Enrollment failed because the robot account refresh token couldn't be 164 // persisted on the device. 165 kMetricEnrollmentRobotRefreshTokenStoreFailed, 166 // Enrollment failed because the administrator has deprovisioned the device. 167 kMetricEnrollmentDeprovisioned, 168 169 kMetricEnrollmentSize // Must be the last. 170 }; 171 172 // Events related to policy refresh. 173 enum MetricPolicyRefresh { 174 // A refresh occurred while the policy was not invalidated and the policy was 175 // changed. Invalidations were enabled. 176 METRIC_POLICY_REFRESH_CHANGED, 177 // A refresh occurred while the policy was not invalidated and the policy was 178 // changed. Invalidations were disabled. 179 METRIC_POLICY_REFRESH_CHANGED_NO_INVALIDATIONS, 180 // A refresh occurred while the policy was not invalidated and the policy was 181 // unchanged. 182 METRIC_POLICY_REFRESH_UNCHANGED, 183 // A refresh occurred while the policy was invalidated and the policy was 184 // changed. 185 METRIC_POLICY_REFRESH_INVALIDATED_CHANGED, 186 // A refresh occurred while the policy was invalidated and the policy was 187 // unchanged. 188 METRIC_POLICY_REFRESH_INVALIDATED_UNCHANGED, 189 190 METRIC_POLICY_REFRESH_SIZE // Must be the last. 191 }; 192 193 // Names for the UMA counters. They are shared from here since the events 194 // from the same enum above can be triggered in different files, and must use 195 // the same UMA histogram name. 196 POLICY_EXPORT extern const char kMetricToken[]; 197 POLICY_EXPORT extern const char kMetricPolicy[]; 198 POLICY_EXPORT extern const char kMetricEnrollment[]; 199 POLICY_EXPORT extern const char kMetricPolicyRefresh[]; 200 POLICY_EXPORT extern const char kMetricPolicyInvalidations[]; 201 202 } // namespace policy 203 204 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_ENTERPRISE_METRICS_H_ 205