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 // This enum is used to define the buckets for an enumerated UMA histogram. 17 // Hence, 18 // (a) existing enumerated constants should never be deleted or reordered, and 19 // (b) new constants should only be appended at the end of the enumeration. 20 enum MetricToken { 21 // A cached token was successfully loaded from disk. 22 kMetricTokenLoadSucceeded = 0, 23 // Reading a cached token from disk failed. 24 kMetricTokenLoadFailed = 1, 25 26 // A token fetch request was sent to the DM server. 27 kMetricTokenFetchRequested = 2, 28 // The request was invalid, or the HTTP request failed. 29 kMetricTokenFetchRequestFailed = 3, 30 // Error HTTP status received, or the DM server failed in another way. 31 kMetricTokenFetchServerFailed = 4, 32 // A response to the fetch request was received. 33 kMetricTokenFetchResponseReceived = 5, 34 // The response received was invalid. This happens when some expected data 35 // was not present in the response. 36 kMetricTokenFetchBadResponse = 6, 37 // DM server reported that management is not supported. 38 kMetricTokenFetchManagementNotSupported = 7, 39 // DM server reported that the given device ID was not found. 40 kMetricTokenFetchDeviceNotFound = 8, 41 // DM token successfully retrieved. 42 kMetricTokenFetchOK = 9, 43 44 // Successfully cached a token to disk. 45 kMetricTokenStoreSucceeded = 10, 46 // Caching a token to disk failed. 47 kMetricTokenStoreFailed = 11, 48 49 // DM server reported that the device-id generated is not unique. 50 kMetricTokenFetchDeviceIdConflict = 12, 51 // DM server reported that the serial number we try to register is invalid. 52 kMetricTokenFetchInvalidSerialNumber = 13, 53 // DM server reported that the licenses for the domain have expired or been 54 // exhausted. 55 kMetricMissingLicenses = 14, 56 57 kMetricTokenSize // Must be the last. 58 }; 59 60 // Events related to fetching, saving and loading user and device policies. 61 // This enum is used to define the buckets for an enumerated UMA histogram. 62 // Hence, 63 // (a) existing enumerated constants should never be deleted or reordered, and 64 // (b) new constants should only be appended at the end of the enumeration. 65 enum MetricPolicy { 66 // A cached policy was successfully loaded from disk. 67 kMetricPolicyLoadSucceeded = 0, 68 // Reading a cached policy from disk failed. 69 kMetricPolicyLoadFailed = 1, 70 71 // A policy fetch request was sent to the DM server. 72 kMetricPolicyFetchRequested = 2, 73 // The request was invalid, or the HTTP request failed. 74 kMetricPolicyFetchRequestFailed = 3, 75 // Error HTTP status received, or the DM server failed in another way. 76 kMetricPolicyFetchServerFailed = 4, 77 // Policy not found for the given user or device. 78 kMetricPolicyFetchNotFound = 5, 79 // DM server didn't accept the token used in the request. 80 kMetricPolicyFetchInvalidToken = 6, 81 // A response to the policy fetch request was received. 82 kMetricPolicyFetchResponseReceived = 7, 83 // The policy response message didn't contain a policy, or other data was 84 // missing. 85 kMetricPolicyFetchBadResponse = 8, 86 // Failed to decode the policy. 87 kMetricPolicyFetchInvalidPolicy = 9, 88 // The device policy was rejected because its signature was invalid. 89 kMetricPolicyFetchBadSignature = 10, 90 // Rejected policy because its timestamp is in the future. 91 kMetricPolicyFetchTimestampInFuture = 11, 92 // Device policy rejected because the device is not managed. 93 kMetricPolicyFetchNonEnterpriseDevice = 12, 94 // The policy was provided for a username that is different from the device 95 // owner, and the policy was rejected. 96 kMetricPolicyFetchUserMismatch = 13, 97 // The policy was rejected for another reason. Currently this can happen 98 // only for device policies, when the SignedSettings fail to store or retrieve 99 // a stored policy. 100 kMetricPolicyFetchOtherFailed = 14, 101 // The fetched policy was accepted. 102 kMetricPolicyFetchOK = 15, 103 // The policy just fetched didn't have any changes compared to the cached 104 // policy. 105 kMetricPolicyFetchNotModified = 16, 106 107 // Successfully cached a policy to disk. 108 kMetricPolicyStoreSucceeded = 17, 109 // Caching a policy to disk failed. 110 kMetricPolicyStoreFailed = 18, 111 112 kMetricPolicySize // Must be the last. 113 }; 114 115 // Events related to device enrollment. 116 // This enum is used to define the buckets for an enumerated UMA histogram. 117 // Hence, 118 // (a) existing enumerated constants should never be deleted or reordered, and 119 // (b) new constants should only be appended at the end of the enumeration. 120 enum MetricEnrollment { 121 // User pressed 'Cancel' during the enrollment process. 122 kMetricEnrollmentCancelled = 0, 123 // User started enrollment process by submitting valid GAIA credentials. 124 kMetricEnrollmentStarted = 1, 125 // OAuth token fetch failed: network error. 126 kMetricEnrollmentNetworkFailed = 2, 127 // OAuth token fetch failed: login error. 128 kMetricEnrollmentLoginFailed = 3, 129 // Registration / policy fetch failed: DM server reports management not 130 // supported. 131 kMetricEnrollmentNotSupported = 4, 132 /* kMetricEnrollmentPolicyFailed = 5 REMOVED */ 133 /* kMetricEnrollmentOtherFailed = 6 REMOVED */ 134 // Enrollment was successful. 135 kMetricEnrollmentOK = 7, 136 // Registration / policy fetch failed: DM server reports that the serial 137 // number we try to register is not assigned to the domain used. 138 kMetricEnrollmentRegisterPolicyInvalidSerial = 8, 139 // Auto-enrollment started automatically after the user signed in. 140 kMetricEnrollmentAutoStarted = 9, 141 // Auto-enrollment failed. 142 kMetricEnrollmentAutoFailed = 10, 143 // Auto-enrollment was retried after having failed before. 144 kMetricEnrollmentAutoRestarted = 11, 145 // Auto-enrollment was canceled through the opt-out dialog. 146 kMetricEnrollmentAutoCancelled = 12, 147 // Auto-enrollment succeeded. 148 kMetricEnrollmentAutoOK = 13, 149 // Registration failed: DM server returns unknown/disallowed enrollment mode. 150 kMetricEnrollmentInvalidEnrollmentMode = 14, 151 // Auto-enrollment is not supported for the mode supplied by the server. This 152 // presently means trying to auto-enroll in kiosk mode. 153 kMetricEnrollmentAutoEnrollmentNotSupported = 15, 154 // Enrollment failed: lockbox initialization took too long to complete. 155 kMetricEnrollmentLockboxTimeoutError = 16, 156 // Re-enrollment device lock failed: domain does not match install attributes. 157 kMetricEnrollmentLockDomainMismatch = 17, 158 // Registration / policy fetch failed: DM server reports licenses expired or 159 // exhausted. 160 kMetricEnrollmentRegisterPolicyMissingLicenses = 18, 161 // Failed to fetch device robot authorization code from DM Server. 162 kMetricEnrollmentRobotAuthCodeFetchFailed = 19, 163 // Failed to fetch device robot refresh token from GAIA. 164 kMetricEnrollmentRobotRefreshTokenFetchFailed = 20, 165 // Failed to persist robot account refresh token on device. 166 kMetricEnrollmentRobotRefreshTokenStoreFailed = 21, 167 // Registration / policy fetch failed: DM server reports administrator 168 // deprovisioned the device. 169 kMetricEnrollmentRegisterPolicyDeprovisioned = 22, 170 // Registration / policy fetch failed: DM server reports domain mismatch. 171 kMetricEnrollmentRegisterPolicyDomainMismatch = 23, 172 // Enrollment has been triggered, the webui login screen has been shown. 173 kMetricEnrollmentTriggered = 24, 174 // The user submitted valid GAIA credentials to start the enrollment process 175 // for the second (or further) time. 176 kMetricEnrollmentRestarted = 25, 177 // Failed to store DM token and device ID. 178 kMetricEnrollmentStoreTokenAndIdFailed = 26, 179 // Failed to obtain FRE state keys. 180 kMetricEnrollmentNoStateKeys = 27, 181 // Failed to validate policy. 182 kMetricEnrollmentPolicyValidationFailed = 28, 183 // Failed due to error in CloudPolicyStore. 184 kMetricEnrollmentCloudPolicyStoreError = 29, 185 // Failed to lock device. 186 kMetricEnrollmentLockBackendError = 30, 187 // Registration / policy fetch failed: DM server reports invalid request 188 // payload. 189 kMetricEnrollmentRegisterPolicyPayloadInvalid = 31, 190 // Registration / policy fetch failed: DM server reports device not found. 191 kMetricEnrollmentRegisterPolicyDeviceNotFound = 32, 192 // Registration / policy fetch failed: DM server reports DM token invalid. 193 kMetricEnrollmentRegisterPolicyDMTokenInvalid = 33, 194 // Registration / policy fetch failed: DM server reports activation pending. 195 kMetricEnrollmentRegisterPolicyActivationPending = 34, 196 // Registration / policy fetch failed: DM server reports device ID conflict. 197 kMetricEnrollmentRegisterPolicyDeviceIdConflict = 35, 198 // Registration / policy fetch failed: DM server can't find policy. 199 kMetricEnrollmentRegisterPolicyNotFound = 36, 200 // Registration / policy fetch failed: HTTP request failed. 201 kMetricEnrollmentRegisterPolicyRequestFailed = 37, 202 // Registration / policy fetch failed: DM server reports temporary problem. 203 kMetricEnrollmentRegisterPolicyTempUnavailable = 38, 204 // Registration / policy fetch failed: DM server returns non-success HTTP 205 // status code. 206 kMetricEnrollmentRegisterPolicyHttpError = 39, 207 // Registration / policy fetch failed: can't decode DM server response. 208 kMetricEnrollmentRegisterPolicyResponseInvalid = 40, 209 // OAuth token fetch failed: account not signed up. 210 kMetricEnrollmentAccountNotSignedUp = 41, 211 // OAuth token fetch failed: account deleted. 212 kMetricEnrollmentAccountDeleted = 42, 213 // OAuth token fetch failed: account disabled. 214 kMetricEnrollmentAccountDisabled = 43, 215 // Re-enrollment pre-check failed: domain does not match install attributes. 216 kMetricEnrollmentPrecheckDomainMismatch = 44 217 }; 218 219 // Events related to policy refresh. 220 // This enum is used to define the buckets for an enumerated UMA histogram. 221 // Hence, 222 // (a) existing enumerated constants should never be deleted or reordered, and 223 // (b) new constants should only be appended at the end of the enumeration. 224 enum MetricPolicyRefresh { 225 // A refresh occurred while the policy was not invalidated and the policy was 226 // changed. Invalidations were enabled. 227 METRIC_POLICY_REFRESH_CHANGED = 0, 228 // A refresh occurred while the policy was not invalidated and the policy was 229 // changed. Invalidations were disabled. 230 METRIC_POLICY_REFRESH_CHANGED_NO_INVALIDATIONS = 1, 231 // A refresh occurred while the policy was not invalidated and the policy was 232 // unchanged. 233 METRIC_POLICY_REFRESH_UNCHANGED = 2, 234 // A refresh occurred while the policy was invalidated and the policy was 235 // changed. 236 METRIC_POLICY_REFRESH_INVALIDATED_CHANGED = 3, 237 // A refresh occurred while the policy was invalidated and the policy was 238 // unchanged. 239 METRIC_POLICY_REFRESH_INVALIDATED_UNCHANGED = 4, 240 241 METRIC_POLICY_REFRESH_SIZE // Must be the last. 242 }; 243 244 // Types of policy invalidations. 245 // This enum is used to define the buckets for an enumerated UMA histogram. 246 // Hence, 247 // (a) existing enumerated constants should never be deleted or reordered, and 248 // (b) new constants should only be appended at the end of the enumeration. 249 enum PolicyInvalidationType { 250 // The invalidation contained no payload. 251 POLICY_INVALIDATION_TYPE_NO_PAYLOAD = 0, 252 // A normal invalidation containing a payload. 253 POLICY_INVALIDATION_TYPE_NORMAL = 1, 254 // The invalidation contained no payload and was considered expired. 255 POLICY_INVALIDATION_TYPE_NO_PAYLOAD_EXPIRED = 3, 256 // The invalidation contained a payload and was considered expired. 257 POLICY_INVALIDATION_TYPE_EXPIRED = 4, 258 259 POLICY_INVALIDATION_TYPE_SIZE // Must be the last. 260 }; 261 262 // Names for the UMA counters. They are shared from here since the events 263 // from the same enum above can be triggered in different files, and must use 264 // the same UMA histogram name. 265 POLICY_EXPORT extern const char kMetricToken[]; 266 POLICY_EXPORT extern const char kMetricPolicy[]; 267 POLICY_EXPORT extern const char kMetricUserPolicyRefresh[]; 268 POLICY_EXPORT extern const char kMetricUserPolicyInvalidations[]; 269 POLICY_EXPORT extern const char kMetricDevicePolicyRefresh[]; 270 POLICY_EXPORT extern const char kMetricDevicePolicyInvalidations[]; 271 272 } // namespace policy 273 274 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_ENTERPRISE_METRICS_H_ 275