summaryrefslogtreecommitdiff
path: root/payload_state.cc
diff options
context:
space:
mode:
authorAlex Deymo <deymo@chromium.org>2013-06-28 11:02:14 -0700
committerChromeBot <chrome-bot@google.com>2013-06-28 14:32:21 -0700
commit1c656c48886cf5054b526ed7e95b05903d7644db (patch)
treea7456ff1878dc4d47ea9f4315982dce748106a58 /payload_state.cc
parentc0602363eaf2a010d2657aadf12dac03cdc7b56e (diff)
Add Installer.PayloadFormat metric
Adds a new PayloadFormat metric with three different values: Delta, Full and ForcedFull. The metric is send whenever an update is applied successfully indicating the type of the used payload. The difference between Full and ForcedFull is that in the ForcedFull, the request sent to omaha included a directive saying that a delta payload wasn't accepted, where a Full payload is one where a delta payload was accepted but a Full payload was provided. BUG=chromium:225977 TEST=cros_workon_make update_engine --test # Three tests added, one for each condition. Change-Id: If44cd96df325d320ed327114cc5e5de3d34a5c62 Reviewed-on: https://gerrit.chromium.org/gerrit/60318 Reviewed-by: David Zeuthen <zeuthen@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org>
Diffstat (limited to 'payload_state.cc')
-rw-r--r--payload_state.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/payload_state.cc b/payload_state.cc
index 20e2cacb..a933ea53 100644
--- a/payload_state.cc
+++ b/payload_state.cc
@@ -156,6 +156,7 @@ void PayloadState::UpdateSucceeded() {
ReportRebootMetrics();
ReportDurationMetrics();
ReportUpdatesAbandonedCountMetric();
+ ReportPayloadTypeMetric();
// Reset the number of responses seen since it counts from the last
// successful update, e.g. now.
@@ -877,6 +878,28 @@ void PayloadState::ReportDurationMetrics() {
prefs_->Delete(kPrefsUpdateDurationUptime);
}
+void PayloadState::ReportPayloadTypeMetric() {
+ string metric;
+ PayloadType uma_payload_type;
+ OmahaRequestParams* params = system_state_->request_params();
+
+ if (response_.is_delta_payload) {
+ uma_payload_type = kPayloadTypeDelta;
+ } else if (params->delta_okay()) {
+ uma_payload_type = kPayloadTypeFull;
+ } else { // Full payload, delta was not allowed by request.
+ uma_payload_type = kPayloadTypeForcedFull;
+ }
+
+ metric = "Installer.PayloadFormat";
+ system_state_->metrics_lib()->SendEnumToUMA(
+ metric,
+ uma_payload_type,
+ kNumPayloadTypes);
+ LOG(INFO) << "Uploading " << utils::ToString(uma_payload_type)
+ << " for metric " << metric;
+}
+
string PayloadState::GetPrefsKey(const string& prefix, DownloadSource source) {
return prefix + "-from-" + utils::ToString(source);
}