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