Alex Deymo | aea4c1c | 2015-08-19 20:24:43 -0700 | [diff] [blame] | 1 | // |
| 2 | // Copyright (C) 2014 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 | // |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 16 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 17 | #include "update_engine/metrics_reporter_omaha.h" |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 18 | |
| 19 | #include <string> |
| 20 | |
| 21 | #include <base/logging.h> |
Alex Deymo | a259179 | 2015-11-17 00:39:40 -0300 | [diff] [blame] | 22 | #include <metrics/metrics_library.h> |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 23 | |
Alex Deymo | 39910dc | 2015-11-09 17:04:30 -0800 | [diff] [blame] | 24 | #include "update_engine/common/clock_interface.h" |
| 25 | #include "update_engine/common/constants.h" |
| 26 | #include "update_engine/common/prefs_interface.h" |
| 27 | #include "update_engine/common/utils.h" |
Alex Deymo | a259179 | 2015-11-17 00:39:40 -0300 | [diff] [blame] | 28 | #include "update_engine/metrics_utils.h" |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 29 | #include "update_engine/system_state.h" |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 30 | |
| 31 | using std::string; |
| 32 | |
| 33 | namespace chromeos_update_engine { |
| 34 | |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 35 | // UpdateEngine.Daily.* metrics. |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 36 | constexpr char kMetricDailyOSAgeDays[] = "UpdateEngine.Daily.OSAgeDays"; |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 37 | |
| 38 | // UpdateEngine.Check.* metrics. |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 39 | constexpr char kMetricCheckDownloadErrorCode[] = |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 40 | "UpdateEngine.Check.DownloadErrorCode"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 41 | constexpr char kMetricCheckReaction[] = "UpdateEngine.Check.Reaction"; |
| 42 | constexpr char kMetricCheckResult[] = "UpdateEngine.Check.Result"; |
| 43 | constexpr char kMetricCheckTimeSinceLastCheckMinutes[] = |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 44 | "UpdateEngine.Check.TimeSinceLastCheckMinutes"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 45 | constexpr char kMetricCheckTimeSinceLastCheckUptimeMinutes[] = |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 46 | "UpdateEngine.Check.TimeSinceLastCheckUptimeMinutes"; |
| 47 | |
| 48 | // UpdateEngine.Attempt.* metrics. |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 49 | constexpr char kMetricAttemptNumber[] = "UpdateEngine.Attempt.Number"; |
| 50 | constexpr char kMetricAttemptPayloadType[] = "UpdateEngine.Attempt.PayloadType"; |
| 51 | constexpr char kMetricAttemptPayloadSizeMiB[] = |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 52 | "UpdateEngine.Attempt.PayloadSizeMiB"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 53 | constexpr char kMetricAttemptConnectionType[] = |
David Zeuthen | b281f07 | 2014-04-02 10:20:19 -0700 | [diff] [blame] | 54 | "UpdateEngine.Attempt.ConnectionType"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 55 | constexpr char kMetricAttemptDurationMinutes[] = |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 56 | "UpdateEngine.Attempt.DurationMinutes"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 57 | constexpr char kMetricAttemptDurationUptimeMinutes[] = |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 58 | "UpdateEngine.Attempt.DurationUptimeMinutes"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 59 | constexpr char kMetricAttemptTimeSinceLastAttemptMinutes[] = |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 60 | "UpdateEngine.Attempt.TimeSinceLastAttemptMinutes"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 61 | constexpr char kMetricAttemptTimeSinceLastAttemptUptimeMinutes[] = |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 62 | "UpdateEngine.Attempt.TimeSinceLastAttemptUptimeMinutes"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 63 | constexpr char kMetricAttemptPayloadBytesDownloadedMiB[] = |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 64 | "UpdateEngine.Attempt.PayloadBytesDownloadedMiB"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 65 | constexpr char kMetricAttemptPayloadDownloadSpeedKBps[] = |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 66 | "UpdateEngine.Attempt.PayloadDownloadSpeedKBps"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 67 | constexpr char kMetricAttemptDownloadSource[] = |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 68 | "UpdateEngine.Attempt.DownloadSource"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 69 | constexpr char kMetricAttemptResult[] = "UpdateEngine.Attempt.Result"; |
| 70 | constexpr char kMetricAttemptInternalErrorCode[] = |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 71 | "UpdateEngine.Attempt.InternalErrorCode"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 72 | constexpr char kMetricAttemptDownloadErrorCode[] = |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 73 | "UpdateEngine.Attempt.DownloadErrorCode"; |
| 74 | |
| 75 | // UpdateEngine.SuccessfulUpdate.* metrics. |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 76 | constexpr char kMetricSuccessfulUpdateAttemptCount[] = |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 77 | "UpdateEngine.SuccessfulUpdate.AttemptCount"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 78 | constexpr char kMetricSuccessfulUpdateBytesDownloadedMiB[] = |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 79 | "UpdateEngine.SuccessfulUpdate.BytesDownloadedMiB"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 80 | constexpr char kMetricSuccessfulUpdateDownloadOverheadPercentage[] = |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 81 | "UpdateEngine.SuccessfulUpdate.DownloadOverheadPercentage"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 82 | constexpr char kMetricSuccessfulUpdateDownloadSourcesUsed[] = |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 83 | "UpdateEngine.SuccessfulUpdate.DownloadSourcesUsed"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 84 | constexpr char kMetricSuccessfulUpdatePayloadType[] = |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 85 | "UpdateEngine.SuccessfulUpdate.PayloadType"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 86 | constexpr char kMetricSuccessfulUpdatePayloadSizeMiB[] = |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 87 | "UpdateEngine.SuccessfulUpdate.PayloadSizeMiB"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 88 | constexpr char kMetricSuccessfulUpdateRebootCount[] = |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 89 | "UpdateEngine.SuccessfulUpdate.RebootCount"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 90 | constexpr char kMetricSuccessfulUpdateTotalDurationMinutes[] = |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 91 | "UpdateEngine.SuccessfulUpdate.TotalDurationMinutes"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 92 | constexpr char kMetricSuccessfulUpdateUpdatesAbandonedCount[] = |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 93 | "UpdateEngine.SuccessfulUpdate.UpdatesAbandonedCount"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 94 | constexpr char kMetricSuccessfulUpdateUrlSwitchCount[] = |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 95 | "UpdateEngine.SuccessfulUpdate.UrlSwitchCount"; |
| 96 | |
David Zeuthen | 96197df | 2014-04-16 12:22:39 -0700 | [diff] [blame] | 97 | // UpdateEngine.Rollback.* metric. |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 98 | constexpr char kMetricRollbackResult[] = "UpdateEngine.Rollback.Result"; |
David Zeuthen | 96197df | 2014-04-16 12:22:39 -0700 | [diff] [blame] | 99 | |
Alex Deymo | c1c17b4 | 2015-11-23 03:53:15 -0300 | [diff] [blame] | 100 | // UpdateEngine.CertificateCheck.* metrics. |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 101 | constexpr char kMetricCertificateCheckUpdateCheck[] = |
Alex Deymo | c1c17b4 | 2015-11-23 03:53:15 -0300 | [diff] [blame] | 102 | "UpdateEngine.CertificateCheck.UpdateCheck"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 103 | constexpr char kMetricCertificateCheckDownload[] = |
Alex Deymo | c1c17b4 | 2015-11-23 03:53:15 -0300 | [diff] [blame] | 104 | "UpdateEngine.CertificateCheck.Download"; |
| 105 | |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 106 | // UpdateEngine.* metrics. |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 107 | constexpr char kMetricFailedUpdateCount[] = "UpdateEngine.FailedUpdateCount"; |
| 108 | constexpr char kMetricInstallDateProvisioningSource[] = |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 109 | "UpdateEngine.InstallDateProvisioningSource"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 110 | constexpr char kMetricTimeToRebootMinutes[] = |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 111 | "UpdateEngine.TimeToRebootMinutes"; |
| 112 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 113 | void MetricsReporterOmaha::Initialize() { |
| 114 | metrics_lib_.Init(); |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 115 | } |
| 116 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 117 | void MetricsReporterOmaha::ReportDailyMetrics(base::TimeDelta os_age) { |
| 118 | string metric = kMetricDailyOSAgeDays; |
| 119 | LOG(INFO) << "Uploading " << utils::FormatTimeDelta(os_age) << " for metric " |
| 120 | << metric; |
| 121 | metrics_lib_.SendToUMA(metric, |
| 122 | static_cast<int>(os_age.InDays()), |
| 123 | 0, // min: 0 days |
| 124 | 6 * 30, // max: 6 months (approx) |
| 125 | 50); // num_buckets |
| 126 | } |
| 127 | |
| 128 | void MetricsReporterOmaha::ReportUpdateCheckMetrics( |
| 129 | SystemState* system_state, |
| 130 | metrics::CheckResult result, |
| 131 | metrics::CheckReaction reaction, |
| 132 | metrics::DownloadErrorCode download_error_code) { |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 133 | string metric; |
| 134 | int value; |
| 135 | int max_value; |
| 136 | |
| 137 | if (result != metrics::CheckResult::kUnset) { |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 138 | metric = kMetricCheckResult; |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 139 | value = static_cast<int>(result); |
| 140 | max_value = static_cast<int>(metrics::CheckResult::kNumConstants) - 1; |
| 141 | LOG(INFO) << "Sending " << value << " for metric " << metric << " (enum)"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 142 | metrics_lib_.SendEnumToUMA(metric, value, max_value); |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 143 | } |
| 144 | if (reaction != metrics::CheckReaction::kUnset) { |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 145 | metric = kMetricCheckReaction; |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 146 | value = static_cast<int>(reaction); |
| 147 | max_value = static_cast<int>(metrics::CheckReaction::kNumConstants) - 1; |
| 148 | LOG(INFO) << "Sending " << value << " for metric " << metric << " (enum)"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 149 | metrics_lib_.SendEnumToUMA(metric, value, max_value); |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 150 | } |
| 151 | if (download_error_code != metrics::DownloadErrorCode::kUnset) { |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 152 | metric = kMetricCheckDownloadErrorCode; |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 153 | value = static_cast<int>(download_error_code); |
David Zeuthen | c0dd021 | 2014-04-04 14:49:49 -0700 | [diff] [blame] | 154 | LOG(INFO) << "Sending " << value << " for metric " << metric << " (sparse)"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 155 | metrics_lib_.SendSparseToUMA(metric, value); |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 156 | } |
| 157 | |
| 158 | base::TimeDelta time_since_last; |
Alex Deymo | a259179 | 2015-11-17 00:39:40 -0300 | [diff] [blame] | 159 | if (metrics_utils::WallclockDurationHelper( |
| 160 | system_state, |
| 161 | kPrefsMetricsCheckLastReportingTime, |
| 162 | &time_since_last)) { |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 163 | metric = kMetricCheckTimeSinceLastCheckMinutes; |
| 164 | LOG(INFO) << "Sending " << utils::FormatTimeDelta(time_since_last) |
| 165 | << " for metric " << metric; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 166 | metrics_lib_.SendToUMA(metric, |
| 167 | time_since_last.InMinutes(), |
| 168 | 0, // min: 0 min |
| 169 | 30 * 24 * 60, // max: 30 days |
| 170 | 50); // num_buckets |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | base::TimeDelta uptime_since_last; |
| 174 | static int64_t uptime_since_last_storage = 0; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 175 | if (metrics_utils::MonotonicDurationHelper( |
| 176 | system_state, &uptime_since_last_storage, &uptime_since_last)) { |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 177 | metric = kMetricCheckTimeSinceLastCheckUptimeMinutes; |
| 178 | LOG(INFO) << "Sending " << utils::FormatTimeDelta(uptime_since_last) |
| 179 | << " for metric " << metric; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 180 | metrics_lib_.SendToUMA(metric, |
| 181 | uptime_since_last.InMinutes(), |
| 182 | 0, // min: 0 min |
| 183 | 30 * 24 * 60, // max: 30 days |
| 184 | 50); // num_buckets |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 185 | } |
| 186 | } |
| 187 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 188 | void MetricsReporterOmaha::ReportAbnormallyTerminatedUpdateAttemptMetrics() { |
| 189 | string metric = kMetricAttemptResult; |
| 190 | metrics::AttemptResult attempt_result = |
| 191 | metrics::AttemptResult::kAbnormalTermination; |
David Zeuthen | 4e1d149 | 2014-04-25 13:12:27 -0700 | [diff] [blame] | 192 | |
| 193 | LOG(INFO) << "Uploading " << static_cast<int>(attempt_result) |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 194 | << " for metric " << metric; |
| 195 | metrics_lib_.SendEnumToUMA( |
David Zeuthen | 4e1d149 | 2014-04-25 13:12:27 -0700 | [diff] [blame] | 196 | metric, |
| 197 | static_cast<int>(attempt_result), |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 198 | static_cast<int>(metrics::AttemptResult::kNumConstants)); |
David Zeuthen | 4e1d149 | 2014-04-25 13:12:27 -0700 | [diff] [blame] | 199 | } |
| 200 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 201 | void MetricsReporterOmaha::ReportUpdateAttemptMetrics( |
| 202 | SystemState* system_state, |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 203 | int attempt_number, |
| 204 | PayloadType payload_type, |
| 205 | base::TimeDelta duration, |
| 206 | base::TimeDelta duration_uptime, |
| 207 | int64_t payload_size, |
| 208 | int64_t payload_bytes_downloaded, |
| 209 | int64_t payload_download_speed_bps, |
| 210 | DownloadSource download_source, |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 211 | metrics::AttemptResult attempt_result, |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 212 | ErrorCode internal_error_code, |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 213 | metrics::DownloadErrorCode payload_download_error_code, |
| 214 | metrics::ConnectionType connection_type) { |
| 215 | string metric = kMetricAttemptNumber; |
| 216 | LOG(INFO) << "Uploading " << attempt_number << " for metric " << metric; |
| 217 | metrics_lib_.SendToUMA(metric, |
| 218 | attempt_number, |
| 219 | 0, // min: 0 attempts |
| 220 | 49, // max: 49 attempts |
| 221 | 50); // num_buckets |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 222 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 223 | metric = kMetricAttemptPayloadType; |
| 224 | LOG(INFO) << "Uploading " << utils::ToString(payload_type) << " for metric " |
| 225 | << metric; |
| 226 | metrics_lib_.SendEnumToUMA(metric, payload_type, kNumPayloadTypes); |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 227 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 228 | metric = kMetricAttemptDurationMinutes; |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 229 | LOG(INFO) << "Uploading " << utils::FormatTimeDelta(duration) |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 230 | << " for metric " << metric; |
| 231 | metrics_lib_.SendToUMA(metric, |
| 232 | duration.InMinutes(), |
| 233 | 0, // min: 0 min |
| 234 | 10 * 24 * 60, // max: 10 days |
| 235 | 50); // num_buckets |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 236 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 237 | metric = kMetricAttemptDurationUptimeMinutes; |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 238 | LOG(INFO) << "Uploading " << utils::FormatTimeDelta(duration_uptime) |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 239 | << " for metric " << metric; |
| 240 | metrics_lib_.SendToUMA(metric, |
| 241 | duration_uptime.InMinutes(), |
| 242 | 0, // min: 0 min |
| 243 | 10 * 24 * 60, // max: 10 days |
| 244 | 50); // num_buckets |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 245 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 246 | metric = kMetricAttemptPayloadSizeMiB; |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 247 | int64_t payload_size_mib = payload_size / kNumBytesInOneMiB; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 248 | LOG(INFO) << "Uploading " << payload_size_mib << " for metric " << metric; |
| 249 | metrics_lib_.SendToUMA(metric, |
| 250 | payload_size_mib, |
| 251 | 0, // min: 0 MiB |
| 252 | 1024, // max: 1024 MiB = 1 GiB |
| 253 | 50); // num_buckets |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 254 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 255 | metric = kMetricAttemptPayloadBytesDownloadedMiB; |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 256 | int64_t payload_bytes_downloaded_mib = |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 257 | payload_bytes_downloaded / kNumBytesInOneMiB; |
| 258 | LOG(INFO) << "Uploading " << payload_bytes_downloaded_mib << " for metric " |
| 259 | << metric; |
| 260 | metrics_lib_.SendToUMA(metric, |
| 261 | payload_bytes_downloaded_mib, |
| 262 | 0, // min: 0 MiB |
| 263 | 1024, // max: 1024 MiB = 1 GiB |
| 264 | 50); // num_buckets |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 265 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 266 | metric = kMetricAttemptPayloadDownloadSpeedKBps; |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 267 | int64_t payload_download_speed_kbps = payload_download_speed_bps / 1000; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 268 | LOG(INFO) << "Uploading " << payload_download_speed_kbps << " for metric " |
| 269 | << metric; |
| 270 | metrics_lib_.SendToUMA(metric, |
| 271 | payload_download_speed_kbps, |
| 272 | 0, // min: 0 kB/s |
| 273 | 10 * 1000, // max: 10000 kB/s = 10 MB/s |
| 274 | 50); // num_buckets |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 275 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 276 | metric = kMetricAttemptDownloadSource; |
| 277 | LOG(INFO) << "Uploading " << download_source << " for metric " << metric; |
| 278 | metrics_lib_.SendEnumToUMA(metric, download_source, kNumDownloadSources); |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 279 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 280 | metric = kMetricAttemptResult; |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 281 | LOG(INFO) << "Uploading " << static_cast<int>(attempt_result) |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 282 | << " for metric " << metric; |
| 283 | metrics_lib_.SendEnumToUMA( |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 284 | metric, |
| 285 | static_cast<int>(attempt_result), |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 286 | static_cast<int>(metrics::AttemptResult::kNumConstants)); |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 287 | |
Gilad Arnold | d1c4d2d | 2014-06-05 14:07:53 -0700 | [diff] [blame] | 288 | if (internal_error_code != ErrorCode::kSuccess) { |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 289 | metric = kMetricAttemptInternalErrorCode; |
| 290 | LOG(INFO) << "Uploading " << internal_error_code << " for metric " |
| 291 | << metric; |
| 292 | metrics_lib_.SendEnumToUMA(metric, |
| 293 | static_cast<int>(internal_error_code), |
| 294 | static_cast<int>(ErrorCode::kUmaReportedMax)); |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 295 | } |
| 296 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 297 | if (payload_download_error_code != metrics::DownloadErrorCode::kUnset) { |
| 298 | metric = kMetricAttemptDownloadErrorCode; |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 299 | LOG(INFO) << "Uploading " << static_cast<int>(payload_download_error_code) |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 300 | << " for metric " << metric << " (sparse)"; |
| 301 | metrics_lib_.SendSparseToUMA(metric, |
| 302 | static_cast<int>(payload_download_error_code)); |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 303 | } |
| 304 | |
| 305 | base::TimeDelta time_since_last; |
Alex Deymo | a259179 | 2015-11-17 00:39:40 -0300 | [diff] [blame] | 306 | if (metrics_utils::WallclockDurationHelper( |
| 307 | system_state, |
| 308 | kPrefsMetricsAttemptLastReportingTime, |
| 309 | &time_since_last)) { |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 310 | metric = kMetricAttemptTimeSinceLastAttemptMinutes; |
| 311 | LOG(INFO) << "Sending " << utils::FormatTimeDelta(time_since_last) |
| 312 | << " for metric " << metric; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 313 | metrics_lib_.SendToUMA(metric, |
| 314 | time_since_last.InMinutes(), |
| 315 | 0, // min: 0 min |
| 316 | 30 * 24 * 60, // max: 30 days |
| 317 | 50); // num_buckets |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 318 | } |
| 319 | |
| 320 | static int64_t uptime_since_last_storage = 0; |
| 321 | base::TimeDelta uptime_since_last; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 322 | if (metrics_utils::MonotonicDurationHelper( |
| 323 | system_state, &uptime_since_last_storage, &uptime_since_last)) { |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 324 | metric = kMetricAttemptTimeSinceLastAttemptUptimeMinutes; |
| 325 | LOG(INFO) << "Sending " << utils::FormatTimeDelta(uptime_since_last) |
| 326 | << " for metric " << metric; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 327 | metrics_lib_.SendToUMA(metric, |
| 328 | uptime_since_last.InMinutes(), |
| 329 | 0, // min: 0 min |
| 330 | 30 * 24 * 60, // max: 30 days |
| 331 | 50); // num_buckets |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 332 | } |
David Zeuthen | b281f07 | 2014-04-02 10:20:19 -0700 | [diff] [blame] | 333 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 334 | metric = kMetricAttemptConnectionType; |
David Zeuthen | b281f07 | 2014-04-02 10:20:19 -0700 | [diff] [blame] | 335 | LOG(INFO) << "Uploading " << static_cast<int>(connection_type) |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 336 | << " for metric " << metric; |
| 337 | metrics_lib_.SendEnumToUMA( |
David Zeuthen | b281f07 | 2014-04-02 10:20:19 -0700 | [diff] [blame] | 338 | metric, |
| 339 | static_cast<int>(connection_type), |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 340 | static_cast<int>(metrics::ConnectionType::kNumConstants)); |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 341 | } |
| 342 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 343 | void MetricsReporterOmaha::ReportSuccessfulUpdateMetrics( |
| 344 | int attempt_count, |
| 345 | int updates_abandoned_count, |
| 346 | PayloadType payload_type, |
| 347 | int64_t payload_size, |
| 348 | int64_t num_bytes_downloaded[kNumDownloadSources], |
| 349 | int download_overhead_percentage, |
| 350 | base::TimeDelta total_duration, |
| 351 | int reboot_count, |
| 352 | int url_switch_count) { |
| 353 | string metric = kMetricSuccessfulUpdatePayloadSizeMiB; |
| 354 | int64_t mbs = payload_size / kNumBytesInOneMiB; |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 355 | LOG(INFO) << "Uploading " << mbs << " (MiBs) for metric " << metric; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 356 | metrics_lib_.SendToUMA(metric, |
| 357 | mbs, |
| 358 | 0, // min: 0 MiB |
| 359 | 1024, // max: 1024 MiB = 1 GiB |
| 360 | 50); // num_buckets |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 361 | |
| 362 | int64_t total_bytes = 0; |
| 363 | int download_sources_used = 0; |
| 364 | for (int i = 0; i < kNumDownloadSources + 1; i++) { |
| 365 | DownloadSource source = static_cast<DownloadSource>(i); |
| 366 | |
| 367 | // Only consider this download source (and send byte counts) as |
| 368 | // having been used if we downloaded a non-trivial amount of bytes |
Alex Vakulenko | 072359c | 2014-07-18 11:41:07 -0700 | [diff] [blame] | 369 | // (e.g. at least 1 MiB) that contributed to the |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 370 | // update. Otherwise we're going to end up with a lot of zero-byte |
| 371 | // events in the histogram. |
| 372 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 373 | metric = kMetricSuccessfulUpdateBytesDownloadedMiB; |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 374 | if (i < kNumDownloadSources) { |
| 375 | metric += utils::ToString(source); |
| 376 | mbs = num_bytes_downloaded[i] / kNumBytesInOneMiB; |
| 377 | total_bytes += num_bytes_downloaded[i]; |
| 378 | if (mbs > 0) |
| 379 | download_sources_used |= (1 << i); |
| 380 | } else { |
| 381 | mbs = total_bytes / kNumBytesInOneMiB; |
| 382 | } |
| 383 | |
| 384 | if (mbs > 0) { |
| 385 | LOG(INFO) << "Uploading " << mbs << " (MiBs) for metric " << metric; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 386 | metrics_lib_.SendToUMA(metric, |
| 387 | mbs, |
| 388 | 0, // min: 0 MiB |
| 389 | 1024, // max: 1024 MiB = 1 GiB |
| 390 | 50); // num_buckets |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 391 | } |
| 392 | } |
| 393 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 394 | metric = kMetricSuccessfulUpdateDownloadSourcesUsed; |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 395 | LOG(INFO) << "Uploading 0x" << std::hex << download_sources_used |
| 396 | << " (bit flags) for metric " << metric; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 397 | metrics_lib_.SendToUMA(metric, |
| 398 | download_sources_used, |
| 399 | 0, // min |
| 400 | (1 << kNumDownloadSources) - 1, // max |
| 401 | 1 << kNumDownloadSources); // num_buckets |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 402 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 403 | metric = kMetricSuccessfulUpdateDownloadOverheadPercentage; |
| 404 | LOG(INFO) << "Uploading " << download_overhead_percentage << "% for metric " |
| 405 | << metric; |
| 406 | metrics_lib_.SendToUMA(metric, |
| 407 | download_overhead_percentage, |
| 408 | 0, // min: 0% overhead |
| 409 | 1000, // max: 1000% overhead |
| 410 | 50); // num_buckets |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 411 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 412 | metric = kMetricSuccessfulUpdateUrlSwitchCount; |
| 413 | LOG(INFO) << "Uploading " << url_switch_count << " (count) for metric " |
| 414 | << metric; |
| 415 | metrics_lib_.SendToUMA(metric, |
| 416 | url_switch_count, |
| 417 | 0, // min: 0 URL switches |
| 418 | 49, // max: 49 URL switches |
| 419 | 50); // num_buckets |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 420 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 421 | metric = kMetricSuccessfulUpdateTotalDurationMinutes; |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 422 | LOG(INFO) << "Uploading " << utils::FormatTimeDelta(total_duration) |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 423 | << " for metric " << metric; |
| 424 | metrics_lib_.SendToUMA(metric, |
| 425 | static_cast<int>(total_duration.InMinutes()), |
| 426 | 0, // min: 0 min |
| 427 | 365 * 24 * 60, // max: 365 days ~= 1 year |
| 428 | 50); // num_buckets |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 429 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 430 | metric = kMetricSuccessfulUpdateRebootCount; |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 431 | LOG(INFO) << "Uploading reboot count of " << reboot_count << " for metric " |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 432 | << metric; |
| 433 | metrics_lib_.SendToUMA(metric, |
| 434 | reboot_count, |
| 435 | 0, // min: 0 reboots |
| 436 | 49, // max: 49 reboots |
| 437 | 50); // num_buckets |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 438 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 439 | metric = kMetricSuccessfulUpdatePayloadType; |
| 440 | metrics_lib_.SendEnumToUMA(metric, payload_type, kNumPayloadTypes); |
| 441 | LOG(INFO) << "Uploading " << utils::ToString(payload_type) << " for metric " |
| 442 | << metric; |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 443 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 444 | metric = kMetricSuccessfulUpdateAttemptCount; |
| 445 | metrics_lib_.SendToUMA(metric, |
| 446 | attempt_count, |
| 447 | 1, // min: 1 attempt |
| 448 | 50, // max: 50 attempts |
| 449 | 50); // num_buckets |
| 450 | LOG(INFO) << "Uploading " << attempt_count << " for metric " << metric; |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 451 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 452 | metric = kMetricSuccessfulUpdateUpdatesAbandonedCount; |
| 453 | LOG(INFO) << "Uploading " << updates_abandoned_count << " (count) for metric " |
| 454 | << metric; |
| 455 | metrics_lib_.SendToUMA(metric, |
| 456 | updates_abandoned_count, |
| 457 | 0, // min: 0 counts |
| 458 | 49, // max: 49 counts |
| 459 | 50); // num_buckets |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 460 | } |
| 461 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 462 | void MetricsReporterOmaha::ReportRollbackMetrics( |
| 463 | metrics::RollbackResult result) { |
| 464 | string metric = kMetricRollbackResult; |
| 465 | int value = static_cast<int>(result); |
David Zeuthen | 96197df | 2014-04-16 12:22:39 -0700 | [diff] [blame] | 466 | LOG(INFO) << "Sending " << value << " for metric " << metric << " (enum)"; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 467 | metrics_lib_.SendEnumToUMA( |
| 468 | metric, value, static_cast<int>(metrics::RollbackResult::kNumConstants)); |
David Zeuthen | 96197df | 2014-04-16 12:22:39 -0700 | [diff] [blame] | 469 | } |
| 470 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 471 | void MetricsReporterOmaha::ReportCertificateCheckMetrics( |
| 472 | ServerToCheck server_to_check, CertificateCheckResult result) { |
Alex Deymo | c1c17b4 | 2015-11-23 03:53:15 -0300 | [diff] [blame] | 473 | string metric; |
| 474 | switch (server_to_check) { |
| 475 | case ServerToCheck::kUpdate: |
| 476 | metric = kMetricCertificateCheckUpdateCheck; |
| 477 | break; |
| 478 | case ServerToCheck::kDownload: |
| 479 | metric = kMetricCertificateCheckDownload; |
| 480 | break; |
Alex Deymo | 33e91e7 | 2015-12-01 18:26:08 -0300 | [diff] [blame] | 481 | case ServerToCheck::kNone: |
| 482 | return; |
Alex Deymo | c1c17b4 | 2015-11-23 03:53:15 -0300 | [diff] [blame] | 483 | } |
| 484 | LOG(INFO) << "Uploading " << static_cast<int>(result) << " for metric " |
| 485 | << metric; |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 486 | metrics_lib_.SendEnumToUMA( |
| 487 | metric, |
| 488 | static_cast<int>(result), |
Alex Deymo | c1c17b4 | 2015-11-23 03:53:15 -0300 | [diff] [blame] | 489 | static_cast<int>(CertificateCheckResult::kNumConstants)); |
| 490 | } |
| 491 | |
Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame^] | 492 | void MetricsReporterOmaha::ReportFailedUpdateCount(int target_attempt) { |
| 493 | string metric = kMetricFailedUpdateCount; |
| 494 | metrics_lib_.SendToUMA(metric, |
| 495 | target_attempt, |
| 496 | 1, // min value |
| 497 | 50, // max value |
| 498 | kNumDefaultUmaBuckets); |
| 499 | |
| 500 | LOG(INFO) << "Uploading " << target_attempt << " (count) for metric " |
| 501 | << metric; |
| 502 | } |
| 503 | |
| 504 | void MetricsReporterOmaha::ReportTimeToReboot(int time_to_reboot_minutes) { |
| 505 | string metric = kMetricTimeToRebootMinutes; |
| 506 | metrics_lib_.SendToUMA(metric, |
| 507 | time_to_reboot_minutes, |
| 508 | 0, // min: 0 minute |
| 509 | 30 * 24 * 60, // max: 1 month (approx) |
| 510 | kNumDefaultUmaBuckets); |
| 511 | |
| 512 | LOG(INFO) << "Uploading " << time_to_reboot_minutes << " for metric " |
| 513 | << metric; |
| 514 | } |
| 515 | |
| 516 | void MetricsReporterOmaha::ReportInstallDateProvisioningSource(int source, |
| 517 | int max) { |
| 518 | metrics_lib_.SendEnumToUMA(kMetricInstallDateProvisioningSource, |
| 519 | source, // Sample. |
| 520 | max); |
| 521 | } |
David Zeuthen | 33bae49 | 2014-02-25 16:16:18 -0800 | [diff] [blame] | 522 | |
| 523 | } // namespace chromeos_update_engine |