blob: 679680c5d3fdf0eee9b2efbbdbde7141b49da4c1 [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
17#ifndef UPDATE_ENGINE_METRICS_CONSTANTS_H_
18#define UPDATE_ENGINE_METRICS_CONSTANTS_H_
19
20namespace chromeos_update_engine {
21
22namespace metrics {
23// The possible outcomes when checking for updates.
24//
25// This is used in the UpdateEngine.Check.Result histogram.
26enum class CheckResult {
27 kUpdateAvailable, // Response indicates an update is available.
28 kNoUpdateAvailable, // Response indicates no updates are available.
29 kDownloadError, // Error downloading response from Omaha.
30 kParsingError, // Error parsing response.
31 kRebootPending, // No update check was performed a reboot is pending.
32
33 kNumConstants,
34 kUnset = -1
35};
36
37// Possible ways a device can react to a new update being available.
38//
39// This is used in the UpdateEngine.Check.Reaction histogram.
40enum class CheckReaction {
41 kUpdating, // Device proceeds to download and apply update.
42 kIgnored, // Device-policy dictates ignoring the update.
43 kDeferring, // Device-policy dictates waiting.
44 kBackingOff, // Previous errors dictates waiting.
45
46 kNumConstants,
47 kUnset = -1
48};
49
50// The possible ways that downloading from a HTTP or HTTPS server can fail.
51//
52// This is used in the UpdateEngine.Check.DownloadErrorCode and
53// UpdateEngine.Attempt.DownloadErrorCode histograms.
54enum class DownloadErrorCode {
55 // Errors that can happen in the field. See http://crbug.com/355745
56 // for how we plan to add more detail in the future.
57 kDownloadError = 0, // Error downloading data from server.
58
59 // IMPORTANT: When adding a new error code, add at the bottom of the
60 // above block and before the kInputMalformed field. This
61 // is to ensure that error codes are not reordered.
62
Xiaochu Liub5ba7972019-07-11 09:51:06 -070063 // This error is reported when libcurl returns CURLE_COULDNT_RESOLVE_HOST and
64 // calling res_init() can recover.
65 kUnresolvedHostRecovered = 97,
66 // This error is reported when libcurl returns CURLE_COULDNT_RESOLVE_HOST.
Amin Hassanid3d84212019-08-17 00:27:44 -070067 kUnresolvedHostError = 98,
Xiaochu Liu4a1173a2019-04-10 10:49:08 -070068 // This error is reported when libcurl has an internal error that
69 // update_engine can't recover from.
Amin Hassanid3d84212019-08-17 00:27:44 -070070 kInternalLibCurlError = 99,
Xiaochu Liu4a1173a2019-04-10 10:49:08 -070071
Tianjie Xu282aa1f2017-09-05 13:42:45 -070072 // This error code is used to convey that malformed input was given
73 // to the utils::GetDownloadErrorCode() function. This should never
74 // happen but if it does it's because of an internal update_engine
75 // error and we're interested in knowing this.
76 kInputMalformed = 100,
77
78 // Bucket for capturing HTTP status codes not in the 200-599
79 // range. This should never happen in practice but if it does we
80 // want to know.
81 kHttpStatusOther = 101,
82
83 // Above 200 and below 600, the value is the HTTP status code.
84 kHttpStatus200 = 200,
85
86 kNumConstants = 600,
87
88 kUnset = -1
89};
90
91// Possible ways an update attempt can end.
92//
93// This is used in the UpdateEngine.Attempt.Result histogram.
94enum class AttemptResult {
95 kUpdateSucceeded, // The update succeeded.
96 kInternalError, // An internal error occurred.
97 kPayloadDownloadError, // Failure while downloading payload.
98 kMetadataMalformed, // Metadata was malformed.
99 kOperationMalformed, // An operation was malformed.
100 kOperationExecutionError, // An operation failed to execute.
101 kMetadataVerificationFailed, // Metadata verification failed.
102 kPayloadVerificationFailed, // Payload verification failed.
103 kVerificationFailed, // Root or Kernel partition verification failed.
104 kPostInstallFailed, // The postinstall step failed.
105 kAbnormalTermination, // The attempt ended abnormally.
106 kUpdateCanceled, // Update canceled by the user.
Sen Jiang02c49422017-10-31 15:14:11 -0700107 kUpdateSucceededNotActive, // Update succeeded but the new slot is not
108 // active.
Andrewb57c16e2020-07-22 14:32:39 -0700109 kUpdateSkipped, // Current update skipped.
Tianjie Xu282aa1f2017-09-05 13:42:45 -0700110 kNumConstants,
111
112 kUnset = -1
113};
114
115// Possible ways the device is connected to the Internet.
116//
117// This is used in the UpdateEngine.Attempt.ConnectionType histogram.
118enum class ConnectionType {
Colin Howesc9e98d62018-09-18 10:35:20 -0700119 kUnknown = 0, // Unknown.
120 kEthernet = 1, // Ethernet.
121 kWifi = 2, // Wireless.
Colin Howesc9e98d62018-09-18 10:35:20 -0700122 kCellular = 5, // Cellular.
123 kTetheredEthernet = 6, // Tethered (Ethernet).
124 kTetheredWifi = 7, // Tethered (Wifi).
125 kDisconnected = 8, // Disconnected.
Alex Khouderchahbfa82262019-08-13 15:00:34 -0700126 // deprecated: kWimax = 3,
127 // deprecated: kBluetooth = 4,
Tianjie Xu282aa1f2017-09-05 13:42:45 -0700128
129 kNumConstants,
130 kUnset = -1
131};
132
133// Possible ways a rollback can end.
134//
135// This is used in the UpdateEngine.Rollback histogram.
136enum class RollbackResult {
137 kFailed,
138 kSuccess,
139
140 kNumConstants
141};
142
143} // namespace metrics
144
145} // namespace chromeos_update_engine
146
147#endif // UPDATE_ENGINE_METRICS_CONSTANTS_H_