blob: af403006026ba6d11e1daed4629b010c1d758ae2 [file] [log] [blame]
Tianjie Xu282aa1f2017-09-05 13:42:45 -07001//
2// Copyright (C) 2017 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
Amin Hassaniec7bc112020-10-29 16:47:58 -070017#ifndef UPDATE_ENGINE_COMMON_METRICS_CONSTANTS_H_
18#define UPDATE_ENGINE_COMMON_METRICS_CONSTANTS_H_
Tianjie Xu282aa1f2017-09-05 13:42:45 -070019
Kelvin Zhang32a73a92022-12-19 12:27:41 -080020#include <chrono>
Tianjie Xu282aa1f2017-09-05 13:42:45 -070021namespace chromeos_update_engine {
22
23namespace metrics {
24// The possible outcomes when checking for updates.
25//
26// This is used in the UpdateEngine.Check.Result histogram.
27enum class CheckResult {
28 kUpdateAvailable, // Response indicates an update is available.
29 kNoUpdateAvailable, // Response indicates no updates are available.
30 kDownloadError, // Error downloading response from Omaha.
31 kParsingError, // Error parsing response.
32 kRebootPending, // No update check was performed a reboot is pending.
33
34 kNumConstants,
35 kUnset = -1
36};
37
38// Possible ways a device can react to a new update being available.
39//
40// This is used in the UpdateEngine.Check.Reaction histogram.
41enum class CheckReaction {
42 kUpdating, // Device proceeds to download and apply update.
43 kIgnored, // Device-policy dictates ignoring the update.
44 kDeferring, // Device-policy dictates waiting.
45 kBackingOff, // Previous errors dictates waiting.
46
47 kNumConstants,
48 kUnset = -1
49};
50
51// The possible ways that downloading from a HTTP or HTTPS server can fail.
52//
53// This is used in the UpdateEngine.Check.DownloadErrorCode and
54// UpdateEngine.Attempt.DownloadErrorCode histograms.
55enum class DownloadErrorCode {
56 // Errors that can happen in the field. See http://crbug.com/355745
57 // for how we plan to add more detail in the future.
58 kDownloadError = 0, // Error downloading data from server.
59
60 // IMPORTANT: When adding a new error code, add at the bottom of the
61 // above block and before the kInputMalformed field. This
62 // is to ensure that error codes are not reordered.
63
Xiaochu Liub5ba7972019-07-11 09:51:06 -070064 // This error is reported when libcurl returns CURLE_COULDNT_RESOLVE_HOST and
65 // calling res_init() can recover.
66 kUnresolvedHostRecovered = 97,
67 // This error is reported when libcurl returns CURLE_COULDNT_RESOLVE_HOST.
Amin Hassanid3d84212019-08-17 00:27:44 -070068 kUnresolvedHostError = 98,
Xiaochu Liu4a1173a2019-04-10 10:49:08 -070069 // This error is reported when libcurl has an internal error that
70 // update_engine can't recover from.
Amin Hassanid3d84212019-08-17 00:27:44 -070071 kInternalLibCurlError = 99,
Xiaochu Liu4a1173a2019-04-10 10:49:08 -070072
Tianjie Xu282aa1f2017-09-05 13:42:45 -070073 // This error code is used to convey that malformed input was given
74 // to the utils::GetDownloadErrorCode() function. This should never
75 // happen but if it does it's because of an internal update_engine
76 // error and we're interested in knowing this.
77 kInputMalformed = 100,
78
79 // Bucket for capturing HTTP status codes not in the 200-599
80 // range. This should never happen in practice but if it does we
81 // want to know.
82 kHttpStatusOther = 101,
83
84 // Above 200 and below 600, the value is the HTTP status code.
85 kHttpStatus200 = 200,
86
87 kNumConstants = 600,
88
89 kUnset = -1
90};
91
92// Possible ways an update attempt can end.
93//
94// This is used in the UpdateEngine.Attempt.Result histogram.
95enum class AttemptResult {
96 kUpdateSucceeded, // The update succeeded.
97 kInternalError, // An internal error occurred.
98 kPayloadDownloadError, // Failure while downloading payload.
99 kMetadataMalformed, // Metadata was malformed.
100 kOperationMalformed, // An operation was malformed.
101 kOperationExecutionError, // An operation failed to execute.
102 kMetadataVerificationFailed, // Metadata verification failed.
103 kPayloadVerificationFailed, // Payload verification failed.
104 kVerificationFailed, // Root or Kernel partition verification failed.
105 kPostInstallFailed, // The postinstall step failed.
106 kAbnormalTermination, // The attempt ended abnormally.
107 kUpdateCanceled, // Update canceled by the user.
Sen Jiang02c49422017-10-31 15:14:11 -0700108 kUpdateSucceededNotActive, // Update succeeded but the new slot is not
109 // active.
Andrewb57c16e2020-07-22 14:32:39 -0700110 kUpdateSkipped, // Current update skipped.
Tianjie Xu282aa1f2017-09-05 13:42:45 -0700111 kNumConstants,
112
113 kUnset = -1
114};
115
116// Possible ways the device is connected to the Internet.
117//
118// This is used in the UpdateEngine.Attempt.ConnectionType histogram.
119enum class ConnectionType {
Colin Howesc9e98d62018-09-18 10:35:20 -0700120 kUnknown = 0, // Unknown.
121 kEthernet = 1, // Ethernet.
122 kWifi = 2, // Wireless.
Colin Howesc9e98d62018-09-18 10:35:20 -0700123 kCellular = 5, // Cellular.
124 kTetheredEthernet = 6, // Tethered (Ethernet).
125 kTetheredWifi = 7, // Tethered (Wifi).
126 kDisconnected = 8, // Disconnected.
Alex Khouderchahbfa82262019-08-13 15:00:34 -0700127 // deprecated: kWimax = 3,
128 // deprecated: kBluetooth = 4,
Tianjie Xu282aa1f2017-09-05 13:42:45 -0700129
130 kNumConstants,
131 kUnset = -1
132};
133
134// Possible ways a rollback can end.
135//
136// This is used in the UpdateEngine.Rollback histogram.
137enum class RollbackResult {
138 kFailed,
139 kSuccess,
140
141 kNumConstants
142};
143
Kelvin Zhang32a73a92022-12-19 12:27:41 -0800144constexpr auto kMetricFlushInterval = std::chrono::seconds(3);
145
Tianjie Xu282aa1f2017-09-05 13:42:45 -0700146} // namespace metrics
147
148} // namespace chromeos_update_engine
149
Amin Hassaniec7bc112020-10-29 16:47:58 -0700150#endif // UPDATE_ENGINE_COMMON_METRICS_CONSTANTS_H_