More helpful error on enrolling already-locked devices.
[chromium-blink-merge.git] / components / policy / core / common / cloud / enterprise_metrics.h
bloba805b8a1228746aff3cd99c6c9882898f1dbd156
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"
10 namespace policy {
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.
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,
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
54 // exhausted.
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.
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,
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,
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.
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 /* kMetricEnrollmentAutoStarted = 9 REMOVED */
140 /* kMetricEnrollmentAutoFailed = 10 REMOVED */
141 /* kMetricEnrollmentAutoRestarted = 11 REMOVED */
142 /* kMetricEnrollmentAutoCancelled = 12 REMOVED */
143 /* kMetricEnrollmentAutoOK = 13 REMOVED */
144 // Registration failed: DM server returns unknown/disallowed enrollment mode.
145 kMetricEnrollmentInvalidEnrollmentMode = 14,
146 /* kMetricEnrollmentAutoEnrollmentNotSupported = 15 REMOVED */
147 // Lockbox initialization took too long to complete.
148 kMetricEnrollmentLockboxTimeoutError = 16,
149 // Lockbox error at re-enrollment: domain does not match install attributes.
150 kMetricEnrollmentLockDomainMismatch = 17,
151 // Registration / policy fetch failed: DM server reports licenses expired or
152 // exhausted.
153 kMetricEnrollmentRegisterPolicyMissingLicenses = 18,
154 // Failed to fetch device robot authorization code from DM Server.
155 kMetricEnrollmentRobotAuthCodeFetchFailed = 19,
156 // Failed to fetch device robot refresh token from GAIA.
157 kMetricEnrollmentRobotRefreshTokenFetchFailed = 20,
158 // Failed to persist robot account refresh token on device.
159 kMetricEnrollmentRobotRefreshTokenStoreFailed = 21,
160 // Registration / policy fetch failed: DM server reports administrator
161 // deprovisioned the device.
162 kMetricEnrollmentRegisterPolicyDeprovisioned = 22,
163 // Registration / policy fetch failed: DM server reports domain mismatch.
164 kMetricEnrollmentRegisterPolicyDomainMismatch = 23,
165 // Enrollment has been triggered, the webui login screen has been shown.
166 kMetricEnrollmentTriggered = 24,
167 // The user submitted valid GAIA credentials to start the enrollment process
168 // for the second (or further) time.
169 kMetricEnrollmentRestarted = 25,
170 // Failed to store DM token and device ID.
171 kMetricEnrollmentStoreTokenAndIdFailed = 26,
172 // Failed to obtain FRE state keys.
173 kMetricEnrollmentNoStateKeys = 27,
174 // Failed to validate policy.
175 kMetricEnrollmentPolicyValidationFailed = 28,
176 // Failed due to error in CloudPolicyStore.
177 kMetricEnrollmentCloudPolicyStoreError = 29,
178 /* kMetricEnrollmentLockBackendError = 30 REMOVED */
179 // Registration / policy fetch failed: DM server reports invalid request
180 // payload.
181 kMetricEnrollmentRegisterPolicyPayloadInvalid = 31,
182 // Registration / policy fetch failed: DM server reports device not found.
183 kMetricEnrollmentRegisterPolicyDeviceNotFound = 32,
184 // Registration / policy fetch failed: DM server reports DM token invalid.
185 kMetricEnrollmentRegisterPolicyDMTokenInvalid = 33,
186 // Registration / policy fetch failed: DM server reports activation pending.
187 kMetricEnrollmentRegisterPolicyActivationPending = 34,
188 // Registration / policy fetch failed: DM server reports device ID conflict.
189 kMetricEnrollmentRegisterPolicyDeviceIdConflict = 35,
190 // Registration / policy fetch failed: DM server can't find policy.
191 kMetricEnrollmentRegisterPolicyNotFound = 36,
192 // Registration / policy fetch failed: HTTP request failed.
193 kMetricEnrollmentRegisterPolicyRequestFailed = 37,
194 // Registration / policy fetch failed: DM server reports temporary problem.
195 kMetricEnrollmentRegisterPolicyTempUnavailable = 38,
196 // Registration / policy fetch failed: DM server returns non-success HTTP
197 // status code.
198 kMetricEnrollmentRegisterPolicyHttpError = 39,
199 // Registration / policy fetch failed: can't decode DM server response.
200 kMetricEnrollmentRegisterPolicyResponseInvalid = 40,
201 // OAuth token fetch failed: account not signed up.
202 kMetricEnrollmentAccountNotSignedUp = 41,
203 // OAuth token fetch failed: account deleted.
204 kMetricEnrollmentAccountDeleted = 42,
205 // OAuth token fetch failed: account disabled.
206 kMetricEnrollmentAccountDisabled = 43,
207 // Re-enrollment pre-check failed: domain does not match install attributes.
208 kMetricEnrollmentPrecheckDomainMismatch = 44,
209 // Lockbox backend failed to initialize.
210 kMetricEnrollmentLockBackendInvalid = 45,
211 // Lockbox backend (TPM) already locked.
212 kMetricEnrollmentLockAlreadyLocked = 46,
213 // Lockbox failure setting attributes.
214 kMetricEnrollmentLockSetError = 47,
215 // Lockbox failure during locking.
216 kMetricEnrollmentLockFinalizeError = 48,
217 // Lockbox read back is inconsistent.
218 kMetricEnrollmentLockReadbackError = 49,
219 // Failed to update device attributes.
220 kMetricEnrollmentAttributeUpdateFailed = 50,
221 // Lockbox error at re-enrollment: mode does not match install attributes.
222 kMetricEnrollmentLockModeMismatch = 51,
225 // Events related to policy refresh.
226 // This enum is used to define the buckets for an enumerated UMA histogram.
227 // Hence,
228 // (a) existing enumerated constants should never be deleted or reordered, and
229 // (b) new constants should only be appended at the end of the enumeration.
230 enum MetricPolicyRefresh {
231 // A refresh occurred while the policy was not invalidated and the policy was
232 // changed. Invalidations were enabled.
233 METRIC_POLICY_REFRESH_CHANGED = 0,
234 // A refresh occurred while the policy was not invalidated and the policy was
235 // changed. Invalidations were disabled.
236 METRIC_POLICY_REFRESH_CHANGED_NO_INVALIDATIONS = 1,
237 // A refresh occurred while the policy was not invalidated and the policy was
238 // unchanged.
239 METRIC_POLICY_REFRESH_UNCHANGED = 2,
240 // A refresh occurred while the policy was invalidated and the policy was
241 // changed.
242 METRIC_POLICY_REFRESH_INVALIDATED_CHANGED = 3,
243 // A refresh occurred while the policy was invalidated and the policy was
244 // unchanged.
245 METRIC_POLICY_REFRESH_INVALIDATED_UNCHANGED = 4,
247 METRIC_POLICY_REFRESH_SIZE // Must be the last.
250 // Types of policy invalidations.
251 // This enum is used to define the buckets for an enumerated UMA histogram.
252 // Hence,
253 // (a) existing enumerated constants should never be deleted or reordered, and
254 // (b) new constants should only be appended at the end of the enumeration.
255 enum PolicyInvalidationType {
256 // The invalidation contained no payload.
257 POLICY_INVALIDATION_TYPE_NO_PAYLOAD = 0,
258 // A normal invalidation containing a payload.
259 POLICY_INVALIDATION_TYPE_NORMAL = 1,
260 // The invalidation contained no payload and was considered expired.
261 POLICY_INVALIDATION_TYPE_NO_PAYLOAD_EXPIRED = 3,
262 // The invalidation contained a payload and was considered expired.
263 POLICY_INVALIDATION_TYPE_EXPIRED = 4,
265 POLICY_INVALIDATION_TYPE_SIZE // Must be the last.
268 // Names for the UMA counters. They are shared from here since the events
269 // from the same enum above can be triggered in different files, and must use
270 // the same UMA histogram name.
271 POLICY_EXPORT extern const char kMetricToken[];
272 POLICY_EXPORT extern const char kMetricPolicy[];
273 POLICY_EXPORT extern const char kMetricUserPolicyRefresh[];
274 POLICY_EXPORT extern const char kMetricUserPolicyInvalidations[];
275 POLICY_EXPORT extern const char kMetricDevicePolicyRefresh[];
276 POLICY_EXPORT extern const char kMetricDevicePolicyInvalidations[];
278 } // namespace policy
280 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_ENTERPRISE_METRICS_H_