Add UpdateEngine.Attempt.ConnectionType metric.
This adds a new metric so we can track the how the device is connected
to the Internet when an attempt starts.
BUG=chromium:358339
TEST=New unit test + unit tests pass.
Change-Id: Ic5c2f50e2396e6baa288aca70906f7112ef7bca9
Reviewed-on: https://chromium-review.googlesource.com/192864
Reviewed-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
diff --git a/metrics.cc b/metrics.cc
index b784b61..1584120 100644
--- a/metrics.cc
+++ b/metrics.cc
@@ -39,6 +39,8 @@
"UpdateEngine.Attempt.PayloadType";
const char kMetricAttemptPayloadSizeMiB[] =
"UpdateEngine.Attempt.PayloadSizeMiB";
+const char kMetricAttemptConnectionType[] =
+ "UpdateEngine.Attempt.ConnectionType";
const char kMetricAttemptDurationMinutes[] =
"UpdateEngine.Attempt.DurationMinutes";
const char kMetricAttemptDurationUptimeMinutes[] =
@@ -180,7 +182,8 @@
DownloadSource download_source,
AttemptResult attempt_result,
ErrorCode internal_error_code,
- DownloadErrorCode payload_download_error_code) {
+ DownloadErrorCode payload_download_error_code,
+ ConnectionType connection_type) {
string metric;
metric = metrics::kMetricAttemptNumber;
@@ -311,6 +314,14 @@
30*24*60, // max: 30 days
50); // num_buckets
}
+
+ metric = metrics::kMetricAttemptConnectionType;
+ LOG(INFO) << "Uploading " << static_cast<int>(connection_type)
+ << " for metric " << metric;
+ system_state->metrics_lib()->SendEnumToUMA(
+ metric,
+ static_cast<int>(connection_type),
+ static_cast<int>(ConnectionType::kNumConstants));
}