diff options
author | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-24 07:04:03 +0000 |
---|---|---|
committer | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-24 07:04:03 +0000 |
commit | 6ee50a8d443f48e70921a8eed76f26a6e9844228 (patch) | |
tree | b83fc706e2a59ac1e2054209a53b65f5d6925744 /chrome/browser/autofill | |
parent | 186c8af18006730780f4dbd5c1d8921bc139e060 (diff) | |
download | chromium_src-6ee50a8d443f48e70921a8eed76f26a6e9844228.zip chromium_src-6ee50a8d443f48e70921a8eed76f26a6e9844228.tar.gz chromium_src-6ee50a8d443f48e70921a8eed76f26a6e9844228.tar.bz2 |
Add UMA metrics to determine the utility of the server query responses.
BUG=64176
TEST=none
Review URL: http://codereview.chromium.org/5326001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67236 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill')
-rw-r--r-- | chrome/browser/autofill/autofill_download.cc | 2 | ||||
-rw-r--r-- | chrome/browser/autofill/autofill_download.h | 1 | ||||
-rw-r--r-- | chrome/browser/autofill/autofill_metrics.cc | 18 | ||||
-rw-r--r-- | chrome/browser/autofill/autofill_metrics.h | 37 | ||||
-rw-r--r-- | chrome/browser/autofill/form_structure.cc | 32 |
5 files changed, 88 insertions, 2 deletions
diff --git a/chrome/browser/autofill/autofill_download.cc b/chrome/browser/autofill/autofill_download.cc index 921cd0a..bef6435 100644 --- a/chrome/browser/autofill/autofill_download.cc +++ b/chrome/browser/autofill/autofill_download.cc @@ -10,6 +10,7 @@ #include "base/logging.h" #include "base/rand_util.h" #include "base/stl_util-inl.h" +#include "chrome/browser/autofill/autofill_metrics.h" #include "chrome/browser/autofill/autofill_xml_parser.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profile.h" @@ -78,6 +79,7 @@ bool AutoFillDownloadManager::StartQueryRequest( return false; request_data.request_type = AutoFillDownloadManager::REQUEST_QUERY; + autofill_metrics::LogServerQueryMetric(autofill_metrics::QUERY_SENT); return StartRequest(form_xml, request_data); } diff --git a/chrome/browser/autofill/autofill_download.h b/chrome/browser/autofill/autofill_download.h index 3b972a1..5987c9d 100644 --- a/chrome/browser/autofill/autofill_download.h +++ b/chrome/browser/autofill/autofill_download.h @@ -25,6 +25,7 @@ class AutoFillDownloadManager : public URLFetcher::Delegate { REQUEST_QUERY, REQUEST_UPLOAD, }; + // An interface used to notify clients of AutoFillDownloadManager. // Notifications are *not* guaranteed to be called. class Observer { diff --git a/chrome/browser/autofill/autofill_metrics.cc b/chrome/browser/autofill/autofill_metrics.cc new file mode 100644 index 0000000..85b5517 --- /dev/null +++ b/chrome/browser/autofill/autofill_metrics.cc @@ -0,0 +1,18 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/autofill/autofill_metrics.h" + +#include "base/metrics/histogram.h" + +namespace autofill_metrics { + +void LogServerQueryMetric(ServerQueryMetricType type) { + DCHECK(type < NUM_SERVER_QUERY_METRICS); + + UMA_HISTOGRAM_ENUMERATION("AutoFill.ServerQueryResponse", type, + NUM_SERVER_QUERY_METRICS); +} + +} // namespace autofill_metrics diff --git a/chrome/browser/autofill/autofill_metrics.h b/chrome/browser/autofill/autofill_metrics.h new file mode 100644 index 0000000..d461668 --- /dev/null +++ b/chrome/browser/autofill/autofill_metrics.h @@ -0,0 +1,37 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_METRICS_H_ +#define CHROME_BROWSER_AUTOFILL_AUTOFILL_METRICS_H_ +#pragma once + +namespace autofill_metrics { + +// Each of these should be logged at most once per query to the server, which in +// turn should occur at most once per page load. +enum ServerQueryMetricType { + // Logged for each query sent to the server + QUERY_SENT = 0, + // Logged for each query response received from the server + QUERY_RESPONSE_RECEIVED, + // Logged for each parsable response received from the server + QUERY_RESPONSE_PARSED, + // Logged for each parsable response that provided no improvements relative to + // our heuristics. + QUERY_RESPONSE_MATCHED_LOCAL_HEURISTICS, + // Logged for each page for which our heuristics detected at least one + // auto-fillable field, but the server response overrode the type of at least + // one field + QUERY_RESPONSE_OVERRODE_LOCAL_HEURISTICS, + // Logged for each page for which our heuristics did not detect any + // auto-fillable fields, but the server response did detect some. + QUERY_RESPONSE_WITH_NO_LOCAL_HEURISTICS, + NUM_SERVER_QUERY_METRICS +}; + +void LogServerQueryMetric(ServerQueryMetricType type); + +} // namespace autofill_metrics + +#endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_METRICS_H_ diff --git a/chrome/browser/autofill/form_structure.cc b/chrome/browser/autofill/form_structure.cc index b5b2db7..bb9da1f 100644 --- a/chrome/browser/autofill/form_structure.cc +++ b/chrome/browser/autofill/form_structure.cc @@ -9,6 +9,7 @@ #include "base/sha1.h" #include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" +#include "chrome/browser/autofill/autofill_metrics.h" #include "chrome/browser/autofill/autofill_xml_parser.h" #include "chrome/browser/autofill/field_types.h" #include "chrome/browser/autofill/form_field.h" @@ -194,6 +195,9 @@ bool FormStructure::EncodeQueryRequest(const ScopedVector<FormStructure>& forms, void FormStructure::ParseQueryResponse(const std::string& response_xml, const std::vector<FormStructure*>& forms, UploadRequired* upload_required) { + autofill_metrics::LogServerQueryMetric( + autofill_metrics::QUERY_RESPONSE_RECEIVED); + // Parse the field types from the server response to the query. std::vector<AutoFillFieldType> field_types; AutoFillQueryXmlParser parse_handler(&field_types, upload_required); @@ -202,16 +206,26 @@ void FormStructure::ParseQueryResponse(const std::string& response_xml, if (!parse_handler.succeeded()) return; + autofill_metrics::LogServerQueryMetric( + autofill_metrics::QUERY_RESPONSE_PARSED); + + bool heuristics_detected_fillable_field = false; + bool query_response_overrode_heuristics = false; + // Copy the field types into the actual form. std::vector<AutoFillFieldType>::iterator current_type = field_types.begin(); for (std::vector<FormStructure*>::const_iterator iter = forms.begin(); iter != forms.end(); ++iter) { FormStructure* form = *iter; + + if (form->has_autofillable_field_) + heuristics_detected_fillable_field = true; + form->has_credit_card_field_ = false; form->has_autofillable_field_ = false; for (std::vector<AutoFillField*>::iterator field = form->fields_.begin(); - field != form->fields_.end(); ++field) { + field != form->fields_.end(); ++field, ++current_type) { // The field list is terminated by a NULL AutoFillField. if (!*field) break; @@ -222,16 +236,30 @@ void FormStructure::ParseQueryResponse(const std::string& response_xml, break; (*field)->set_server_type(*current_type); + if ((*field)->heuristic_type() != (*field)->server_type()) + query_response_overrode_heuristics = true; + AutoFillType autofill_type((*field)->type()); if (autofill_type.group() == AutoFillType::CREDIT_CARD) form->has_credit_card_field_ = true; if (autofill_type.field_type() != UNKNOWN_TYPE) form->has_autofillable_field_ = true; - ++current_type; } form->UpdateAutoFillCount(); } + + autofill_metrics::ServerQueryMetricType metric_type; + if (query_response_overrode_heuristics) { + if (heuristics_detected_fillable_field) { + metric_type = autofill_metrics::QUERY_RESPONSE_OVERRODE_LOCAL_HEURISTICS; + } else { + metric_type = autofill_metrics::QUERY_RESPONSE_WITH_NO_LOCAL_HEURISTICS; + } + } else { + metric_type = autofill_metrics::QUERY_RESPONSE_MATCHED_LOCAL_HEURISTICS; + } + autofill_metrics::LogServerQueryMetric(metric_type); } std::string FormStructure::FormSignature() const { |