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