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