metrics_constants.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. //
  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. #ifndef UPDATE_ENGINE_METRICS_CONSTANTS_H_
  17. #define UPDATE_ENGINE_METRICS_CONSTANTS_H_
  18. namespace chromeos_update_engine {
  19. namespace metrics {
  20. // The possible outcomes when checking for updates.
  21. //
  22. // This is used in the UpdateEngine.Check.Result histogram.
  23. enum class CheckResult {
  24. kUpdateAvailable, // Response indicates an update is available.
  25. kNoUpdateAvailable, // Response indicates no updates are available.
  26. kDownloadError, // Error downloading response from Omaha.
  27. kParsingError, // Error parsing response.
  28. kRebootPending, // No update check was performed a reboot is pending.
  29. kNumConstants,
  30. kUnset = -1
  31. };
  32. // Possible ways a device can react to a new update being available.
  33. //
  34. // This is used in the UpdateEngine.Check.Reaction histogram.
  35. enum class CheckReaction {
  36. kUpdating, // Device proceeds to download and apply update.
  37. kIgnored, // Device-policy dictates ignoring the update.
  38. kDeferring, // Device-policy dictates waiting.
  39. kBackingOff, // Previous errors dictates waiting.
  40. kNumConstants,
  41. kUnset = -1
  42. };
  43. // The possible ways that downloading from a HTTP or HTTPS server can fail.
  44. //
  45. // This is used in the UpdateEngine.Check.DownloadErrorCode and
  46. // UpdateEngine.Attempt.DownloadErrorCode histograms.
  47. enum class DownloadErrorCode {
  48. // Errors that can happen in the field. See http://crbug.com/355745
  49. // for how we plan to add more detail in the future.
  50. kDownloadError = 0, // Error downloading data from server.
  51. // IMPORTANT: When adding a new error code, add at the bottom of the
  52. // above block and before the kInputMalformed field. This
  53. // is to ensure that error codes are not reordered.
  54. // This error code is used to convey that malformed input was given
  55. // to the utils::GetDownloadErrorCode() function. This should never
  56. // happen but if it does it's because of an internal update_engine
  57. // error and we're interested in knowing this.
  58. kInputMalformed = 100,
  59. // Bucket for capturing HTTP status codes not in the 200-599
  60. // range. This should never happen in practice but if it does we
  61. // want to know.
  62. kHttpStatusOther = 101,
  63. // Above 200 and below 600, the value is the HTTP status code.
  64. kHttpStatus200 = 200,
  65. kNumConstants = 600,
  66. kUnset = -1
  67. };
  68. // Possible ways an update attempt can end.
  69. //
  70. // This is used in the UpdateEngine.Attempt.Result histogram.
  71. enum class AttemptResult {
  72. kUpdateSucceeded, // The update succeeded.
  73. kInternalError, // An internal error occurred.
  74. kPayloadDownloadError, // Failure while downloading payload.
  75. kMetadataMalformed, // Metadata was malformed.
  76. kOperationMalformed, // An operation was malformed.
  77. kOperationExecutionError, // An operation failed to execute.
  78. kMetadataVerificationFailed, // Metadata verification failed.
  79. kPayloadVerificationFailed, // Payload verification failed.
  80. kVerificationFailed, // Root or Kernel partition verification failed.
  81. kPostInstallFailed, // The postinstall step failed.
  82. kAbnormalTermination, // The attempt ended abnormally.
  83. kUpdateCanceled, // Update canceled by the user.
  84. kUpdateSucceededNotActive, // Update succeeded but the new slot is not
  85. // active.
  86. kNumConstants,
  87. kUnset = -1
  88. };
  89. // Possible ways the device is connected to the Internet.
  90. //
  91. // This is used in the UpdateEngine.Attempt.ConnectionType histogram.
  92. enum class ConnectionType {
  93. kUnknown = 0, // Unknown.
  94. kEthernet = 1, // Ethernet.
  95. kWifi = 2, // Wireless.
  96. kWimax = 3, // WiMax.
  97. kBluetooth = 4, // Bluetooth.
  98. kCellular = 5, // Cellular.
  99. kTetheredEthernet = 6, // Tethered (Ethernet).
  100. kTetheredWifi = 7, // Tethered (Wifi).
  101. kDisconnected = 8, // Disconnected.
  102. kNumConstants,
  103. kUnset = -1
  104. };
  105. // Possible ways a rollback can end.
  106. //
  107. // This is used in the UpdateEngine.Rollback histogram.
  108. enum class RollbackResult {
  109. kFailed,
  110. kSuccess,
  111. kNumConstants
  112. };
  113. } // namespace metrics
  114. } // namespace chromeos_update_engine
  115. #endif // UPDATE_ENGINE_METRICS_CONSTANTS_H_