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.
5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_ENTERPRISE_METRICS_H_
6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_ENTERPRISE_METRICS_H_
8 #include "components/policy/policy_export.h"
12 // Metrics collected for enterprise events.
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.
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.
21 // A cached token was successfully loaded from disk.
22 kMetricTokenLoadSucceeded = 0,
23 // Reading a cached token from disk failed.
24 kMetricTokenLoadFailed = 1,
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,
44 // Successfully cached a token to disk.
45 kMetricTokenStoreSucceeded = 10,
46 // Caching a token to disk failed.
47 kMetricTokenStoreFailed = 11,
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
55 kMetricMissingLicenses = 14,
57 kMetricTokenSize // Must be the last.
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.
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.
66 // A cached policy was successfully loaded from disk.
67 kMetricPolicyLoadSucceeded = 0,
68 // Reading a cached policy from disk failed.
69 kMetricPolicyLoadFailed = 1,
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
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
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
105 kMetricPolicyFetchNotModified = 16,
107 // Successfully cached a policy to disk.
108 kMetricPolicyStoreSucceeded = 17,
109 // Caching a policy to disk failed.
110 kMetricPolicyStoreFailed = 18,
112 kMetricPolicySize // Must be the last.
115 // Events related to device enrollment.
116 // This enum is used to define the buckets for an enumerated UMA histogram.
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
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 // Lockbox initialization took too long to complete.
155 kMetricEnrollmentLockboxTimeoutError = 16,
156 // Lockbox error at re-enrollment: domain does not match install attributes.
157 kMetricEnrollmentLockDomainMismatch = 17,
158 // Registration / policy fetch failed: DM server reports licenses expired or
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 /* kMetricEnrollmentLockBackendError = 30 REMOVED */
186 // Registration / policy fetch failed: DM server reports invalid request
188 kMetricEnrollmentRegisterPolicyPayloadInvalid = 31,
189 // Registration / policy fetch failed: DM server reports device not found.
190 kMetricEnrollmentRegisterPolicyDeviceNotFound = 32,
191 // Registration / policy fetch failed: DM server reports DM token invalid.
192 kMetricEnrollmentRegisterPolicyDMTokenInvalid = 33,
193 // Registration / policy fetch failed: DM server reports activation pending.
194 kMetricEnrollmentRegisterPolicyActivationPending = 34,
195 // Registration / policy fetch failed: DM server reports device ID conflict.
196 kMetricEnrollmentRegisterPolicyDeviceIdConflict = 35,
197 // Registration / policy fetch failed: DM server can't find policy.
198 kMetricEnrollmentRegisterPolicyNotFound = 36,
199 // Registration / policy fetch failed: HTTP request failed.
200 kMetricEnrollmentRegisterPolicyRequestFailed = 37,
201 // Registration / policy fetch failed: DM server reports temporary problem.
202 kMetricEnrollmentRegisterPolicyTempUnavailable = 38,
203 // Registration / policy fetch failed: DM server returns non-success HTTP
205 kMetricEnrollmentRegisterPolicyHttpError = 39,
206 // Registration / policy fetch failed: can't decode DM server response.
207 kMetricEnrollmentRegisterPolicyResponseInvalid = 40,
208 // OAuth token fetch failed: account not signed up.
209 kMetricEnrollmentAccountNotSignedUp = 41,
210 // OAuth token fetch failed: account deleted.
211 kMetricEnrollmentAccountDeleted = 42,
212 // OAuth token fetch failed: account disabled.
213 kMetricEnrollmentAccountDisabled = 43,
214 // Re-enrollment pre-check failed: domain does not match install attributes.
215 kMetricEnrollmentPrecheckDomainMismatch = 44,
216 // Lockbox backend failed to initialize.
217 kMetricEnrollmentLockBackendInvalid = 45,
218 // Lockbox backend (TPM) already locked.
219 kMetricEnrollmentLockAlreadyLocked = 46,
220 // Lockbox failure setting attributes.
221 kMetricEnrollmentLockSetError = 47,
222 // Lockbox failure during locking.
223 kMetricEnrollmentLockFinalizeError = 48,
224 // Lockbox read back is inconsistent.
225 kMetricEnrollmentLockReadbackError = 49,
228 // Events related to policy refresh.
229 // This enum is used to define the buckets for an enumerated UMA histogram.
231 // (a) existing enumerated constants should never be deleted or reordered, and
232 // (b) new constants should only be appended at the end of the enumeration.
233 enum MetricPolicyRefresh {
234 // A refresh occurred while the policy was not invalidated and the policy was
235 // changed. Invalidations were enabled.
236 METRIC_POLICY_REFRESH_CHANGED = 0,
237 // A refresh occurred while the policy was not invalidated and the policy was
238 // changed. Invalidations were disabled.
239 METRIC_POLICY_REFRESH_CHANGED_NO_INVALIDATIONS = 1,
240 // A refresh occurred while the policy was not invalidated and the policy was
242 METRIC_POLICY_REFRESH_UNCHANGED = 2,
243 // A refresh occurred while the policy was invalidated and the policy was
245 METRIC_POLICY_REFRESH_INVALIDATED_CHANGED = 3,
246 // A refresh occurred while the policy was invalidated and the policy was
248 METRIC_POLICY_REFRESH_INVALIDATED_UNCHANGED = 4,
250 METRIC_POLICY_REFRESH_SIZE // Must be the last.
253 // Types of policy invalidations.
254 // This enum is used to define the buckets for an enumerated UMA histogram.
256 // (a) existing enumerated constants should never be deleted or reordered, and
257 // (b) new constants should only be appended at the end of the enumeration.
258 enum PolicyInvalidationType {
259 // The invalidation contained no payload.
260 POLICY_INVALIDATION_TYPE_NO_PAYLOAD = 0,
261 // A normal invalidation containing a payload.
262 POLICY_INVALIDATION_TYPE_NORMAL = 1,
263 // The invalidation contained no payload and was considered expired.
264 POLICY_INVALIDATION_TYPE_NO_PAYLOAD_EXPIRED = 3,
265 // The invalidation contained a payload and was considered expired.
266 POLICY_INVALIDATION_TYPE_EXPIRED = 4,
268 POLICY_INVALIDATION_TYPE_SIZE // Must be the last.
271 // Names for the UMA counters. They are shared from here since the events
272 // from the same enum above can be triggered in different files, and must use
273 // the same UMA histogram name.
274 POLICY_EXPORT extern const char kMetricToken[];
275 POLICY_EXPORT extern const char kMetricPolicy[];
276 POLICY_EXPORT extern const char kMetricUserPolicyRefresh[];
277 POLICY_EXPORT extern const char kMetricUserPolicyInvalidations[];
278 POLICY_EXPORT extern const char kMetricDevicePolicyRefresh[];
279 POLICY_EXPORT extern const char kMetricDevicePolicyInvalidations[];
281 } // namespace policy
283 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_ENTERPRISE_METRICS_H_