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 // The enrollment screen was closed without completing the enrollment
123 kMetricEnrollmentCancelled = 0,
124 // The user submitted credentials and started the enrollment process.
125 kMetricEnrollmentStarted = 1,
126 // Enrollment failed due to a network error.
127 kMetricEnrollmentNetworkFailed = 2,
128 // Enrollment failed because logging in to Gaia failed.
129 kMetricEnrollmentLoginFailed = 3,
130 // Enrollment failed because it is not supported for the account used.
131 kMetricEnrollmentNotSupported = 4,
132 // Enrollment failed because it failed to apply device policy.
133 kMetricEnrollmentPolicyFailed = 5,
134 // Enrollment failed due to an unexpected error. This currently happens when
135 // the Gaia auth token is not issued for the DM service, the device cloud
136 // policy subsystem isn't initialized, or when fetching Gaia tokens fails
137 // for an unknown reason.
138 kMetricEnrollmentOtherFailed = 6,
139 // Enrollment was successful.
140 kMetricEnrollmentOK = 7,
141 // Enrollment failed because the serial number we try to register is not
142 // assigned to the domain used.
143 kMetricEnrollmentInvalidSerialNumber = 8,
144 // Auto-enrollment started automatically after the user signed in.
145 kMetricEnrollmentAutoStarted = 9,
146 // Auto-enrollment failed.
147 kMetricEnrollmentAutoFailed = 10,
148 // Auto-enrollment was retried after having failed before.
149 kMetricEnrollmentAutoRetried = 11,
150 // Auto-enrollment was canceled through the opt-out dialog.
151 kMetricEnrollmentAutoCancelled = 12,
152 // Auto-enrollment succeeded.
153 kMetricEnrollmentAutoOK = 13,
154 // Enrollment failed because the enrollment mode was not supplied by the
155 // DMServer or the mode is not known to the client.
156 kMetricEnrollmentInvalidEnrollmentMode = 14,
157 // Auto-enrollment is not supported for the mode supplied by the server.
158 // This presently means trying to auto-enroll in kiosk mode.
159 kMetricEnrollmentAutoEnrollmentNotSupported = 15,
160 // The lockbox initialization has taken too long to complete and the
161 // enrollment has been canceled because of that.
162 kMetricLockboxTimeoutError = 16,
163 // The username used to re-enroll the device does not belong to the domain
164 // that the device was initially enrolled to.
165 kMetricEnrollmentWrongUserError = 17,
166 // DM server reported that the licenses for the domain has expired or been
168 kMetricMissingLicensesError = 18,
169 // Enrollment failed because the robot account auth code couldn't be
170 // fetched from the DM Server.
171 kMetricEnrollmentRobotAuthCodeFetchFailed = 19,
172 // Enrollment failed because the robot account auth code couldn't be
173 // exchanged for a refresh token.
174 kMetricEnrollmentRobotRefreshTokenFetchFailed = 20,
175 // Enrollment failed because the robot account refresh token couldn't be
176 // persisted on the device.
177 kMetricEnrollmentRobotRefreshTokenStoreFailed = 21,
178 // Enrollment failed because the administrator has deprovisioned the device.
179 kMetricEnrollmentDeprovisioned = 22,
180 // Enrollment failed because the device doesn't belong to the domain.
181 kMetricEnrollmentDomainMismatch = 23,
182 // Enrollment has been triggered, the credential screen has been shown.
183 kMetricEnrollmentTriggered = 24,
184 // The user retried to submitted credentials.
185 kMetricEnrollmentRetried = 25,
186 // Enrollment failed because DM token and device ID couldn't be stored.
187 kMetricEnrollmentStoreTokenAndIdFailed = 26,
188 // Enrollment failed because FRE state keys couldn't be obtained.
189 kMetricEnrollmentNoStateKeys = 27,
190 // Enrollment failed because policy couldn't be validated.
191 kMetricEnrollmentPolicyValidationFailed = 28,
192 // Enrollment failed because of error in CloudPolicyStore.
193 kMetricEnrollmentCloudPolicyStoreError = 29,
194 // Enrollment failed because device couldn't be locked.
195 kMetricEnrollmentLockBackendError = 30,
197 kMetricEnrollmentSize // Must be the last.
200 // Events related to policy refresh.
201 // This enum is used to define the buckets for an enumerated UMA histogram.
203 // (a) existing enumerated constants should never be deleted or reordered, and
204 // (b) new constants should only be appended at the end of the enumeration.
205 enum MetricPolicyRefresh {
206 // A refresh occurred while the policy was not invalidated and the policy was
207 // changed. Invalidations were enabled.
208 METRIC_POLICY_REFRESH_CHANGED = 0,
209 // A refresh occurred while the policy was not invalidated and the policy was
210 // changed. Invalidations were disabled.
211 METRIC_POLICY_REFRESH_CHANGED_NO_INVALIDATIONS = 1,
212 // A refresh occurred while the policy was not invalidated and the policy was
214 METRIC_POLICY_REFRESH_UNCHANGED = 2,
215 // A refresh occurred while the policy was invalidated and the policy was
217 METRIC_POLICY_REFRESH_INVALIDATED_CHANGED = 3,
218 // A refresh occurred while the policy was invalidated and the policy was
220 METRIC_POLICY_REFRESH_INVALIDATED_UNCHANGED = 4,
222 METRIC_POLICY_REFRESH_SIZE // Must be the last.
225 // Types of policy invalidations.
226 // This enum is used to define the buckets for an enumerated UMA histogram.
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 PolicyInvalidationType {
231 // The invalidation contained no payload.
232 POLICY_INVALIDATION_TYPE_NO_PAYLOAD = 0,
233 // A normal invalidation containing a payload.
234 POLICY_INVALIDATION_TYPE_NORMAL = 1,
235 // The invalidation contained no payload and was considered expired.
236 POLICY_INVALIDATION_TYPE_NO_PAYLOAD_EXPIRED = 3,
237 // The invalidation contained a payload and was considered expired.
238 POLICY_INVALIDATION_TYPE_EXPIRED = 4,
240 POLICY_INVALIDATION_TYPE_SIZE // Must be the last.
243 // Names for the UMA counters. They are shared from here since the events
244 // from the same enum above can be triggered in different files, and must use
245 // the same UMA histogram name.
246 POLICY_EXPORT extern const char kMetricToken[];
247 POLICY_EXPORT extern const char kMetricPolicy[];
248 POLICY_EXPORT extern const char kMetricEnrollment[];
249 POLICY_EXPORT extern const char kMetricEnrollmentRecovery[];
250 POLICY_EXPORT extern const char kMetricUserPolicyRefresh[];
251 POLICY_EXPORT extern const char kMetricUserPolicyInvalidations[];
252 POLICY_EXPORT extern const char kMetricDevicePolicyRefresh[];
253 POLICY_EXPORT extern const char kMetricDevicePolicyInvalidations[];
255 } // namespace policy
257 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_ENTERPRISE_METRICS_H_