diff options
author | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-14 23:38:18 +0000 |
---|---|---|
committer | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-14 23:38:18 +0000 |
commit | 2ab1ecb73cabe4000f9ddfeb73ef62a3e21d5cde (patch) | |
tree | 451dc03a3b202e4814d60f62534a8afc16337210 | |
parent | 406e315006265b73b82b0cb6af0c943ee9c1626f (diff) | |
download | chromium_src-2ab1ecb73cabe4000f9ddfeb73ef62a3e21d5cde.zip chromium_src-2ab1ecb73cabe4000f9ddfeb73ef62a3e21d5cde.tar.gz chromium_src-2ab1ecb73cabe4000f9ddfeb73ef62a3e21d5cde.tar.bz2 |
Add some more metrics/logging to dig into Autofill server experiments data discrepancy.
* Log the form's server experiment id at form submission time.
* Prior to receiving a server response to a query request, set the experiment id to "unknown experiment"
BUG=none
TEST=unit_tests --gtest_filter=AutofillMetrics.*
Review URL: http://codereview.chromium.org/7147008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89094 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/autofill/autofill_metrics.cc | 62 | ||||
-rw-r--r-- | chrome/browser/autofill/autofill_metrics.h | 7 | ||||
-rw-r--r-- | chrome/browser/autofill/autofill_metrics_unittest.cc | 18 | ||||
-rw-r--r-- | chrome/browser/autofill/form_structure.cc | 7 |
4 files changed, 61 insertions, 33 deletions
diff --git a/chrome/browser/autofill/autofill_metrics.cc b/chrome/browser/autofill/autofill_metrics.cc index cfa0de4f..bb4df43 100644 --- a/chrome/browser/autofill/autofill_metrics.cc +++ b/chrome/browser/autofill/autofill_metrics.cc @@ -192,6 +192,36 @@ void LogTypeQualityMetric(const std::string& base_name, num_field_type_group_metrics); } +void LogServerExperimentId(const std::string& histogram_name, + const std::string& experiment_id) { + ServerExperiment metric = UNKNOWN_EXPERIMENT; + + if (experiment_id.empty()) + metric = NO_EXPERIMENT; + else if (experiment_id == "ar06") + metric = ACCEPTANCE_RATIO_06; + else if (experiment_id == "ar1") + metric = ACCEPTANCE_RATIO_1; + else if (experiment_id == "ar2") + metric = ACCEPTANCE_RATIO_2; + else if (experiment_id == "ar4") + metric = ACCEPTANCE_RATIO_4; + else if (experiment_id == "ar05wlr15") + metric = ACCEPTANCE_RATIO_05_WINNER_LEAD_RATIO_15; + else if (experiment_id == "ar05wlr25") + metric = ACCEPTANCE_RATIO_05_WINNER_LEAD_RATIO_25; + else if (experiment_id == "ar05wr15fs5") + metric = ACCEPTANCE_RATIO_05_WINNER_LEAD_RATIO_15_MIN_FORM_SCORE_5; + else if (experiment_id == "tbar1") + metric = TOOLBAR_DATA_ONLY; + else if (experiment_id == "ar04wr3fs4") + metric = ACCEPTANCE_RATIO_04_WINNER_LEAD_RATIO_3_MIN_FORM_SCORE_4; + + DCHECK(metric < NUM_SERVER_EXPERIMENTS); + UMA_HISTOGRAM_ENUMERATION(histogram_name, metric, + NUM_SERVER_EXPERIMENTS); +} + } // namespace AutofillMetrics::AutofillMetrics() { @@ -268,32 +298,12 @@ void AutofillMetrics::LogAddressSuggestionsCount(size_t num_suggestions) const { UMA_HISTOGRAM_COUNTS("Autofill.AddressSuggestionsCount", num_suggestions); } -void AutofillMetrics::LogServerExperimentId( +void AutofillMetrics::LogServerExperimentIdForQuery( const std::string& experiment_id) const { - ServerExperiment metric = UNKNOWN_EXPERIMENT; - - if (experiment_id.empty()) - metric = NO_EXPERIMENT; - else if (experiment_id == "ar06") - metric = ACCEPTANCE_RATIO_06; - else if (experiment_id == "ar1") - metric = ACCEPTANCE_RATIO_1; - else if (experiment_id == "ar2") - metric = ACCEPTANCE_RATIO_2; - else if (experiment_id == "ar4") - metric = ACCEPTANCE_RATIO_4; - else if (experiment_id == "ar05wlr15") - metric = ACCEPTANCE_RATIO_05_WINNER_LEAD_RATIO_15; - else if (experiment_id == "ar05wlr25") - metric = ACCEPTANCE_RATIO_05_WINNER_LEAD_RATIO_25; - else if (experiment_id == "ar05wr15fs5") - metric = ACCEPTANCE_RATIO_05_WINNER_LEAD_RATIO_15_MIN_FORM_SCORE_5; - else if (experiment_id == "tbar1") - metric = TOOLBAR_DATA_ONLY; - else if (experiment_id == "ar04wr3fs4") - metric = ACCEPTANCE_RATIO_04_WINNER_LEAD_RATIO_3_MIN_FORM_SCORE_4; + LogServerExperimentId("Autofill.ServerExperimentId.Query", experiment_id); +} - DCHECK(metric < NUM_SERVER_EXPERIMENTS); - UMA_HISTOGRAM_ENUMERATION("Autofill.ServerExperimentId", metric, - NUM_SERVER_EXPERIMENTS); +void AutofillMetrics::LogServerExperimentIdForUpload( + const std::string& experiment_id) const { + LogServerExperimentId("Autofill.ServerExperimentId.Upload", experiment_id); } diff --git a/chrome/browser/autofill/autofill_metrics.h b/chrome/browser/autofill/autofill_metrics.h index 2584317..22bd74b 100644 --- a/chrome/browser/autofill/autofill_metrics.h +++ b/chrome/browser/autofill/autofill_metrics.h @@ -116,7 +116,12 @@ class AutofillMetrics { virtual void LogAddressSuggestionsCount(size_t num_suggestions) const; // Logs the experiment id corresponding to a server query response. - virtual void LogServerExperimentId(const std::string& experiment_id) const; + virtual void LogServerExperimentIdForQuery( + const std::string& experiment_id) const; + + // Logs the experiment id corresponding to an upload to the server. + virtual void LogServerExperimentIdForUpload( + const std::string& experiment_id) const; private: DISALLOW_COPY_AND_ASSIGN(AutofillMetrics); diff --git a/chrome/browser/autofill/autofill_metrics_unittest.cc b/chrome/browser/autofill/autofill_metrics_unittest.cc index a87c8f0..c942842 100644 --- a/chrome/browser/autofill/autofill_metrics_unittest.cc +++ b/chrome/browser/autofill/autofill_metrics_unittest.cc @@ -49,7 +49,9 @@ class MockAutofillMetrics : public AutofillMetrics { MOCK_CONST_METHOD1(LogIsAutofillEnabledAtStartup, void(bool enabled)); MOCK_CONST_METHOD1(LogStoredProfileCount, void(size_t num_profiles)); MOCK_CONST_METHOD1(LogAddressSuggestionsCount, void(size_t num_suggestions)); - MOCK_CONST_METHOD1(LogServerExperimentId, + MOCK_CONST_METHOD1(LogServerExperimentIdForQuery, + void(const std::string& experiment_id)); + MOCK_CONST_METHOD1(LogServerExperimentIdForUpload, void(const std::string& experiment_id)); private: @@ -289,6 +291,8 @@ TEST_F(AutofillMetricsTest, QualityMetrics) { // Establish our expectations. ::testing::InSequence dummy; + EXPECT_CALL(*autofill_manager_->metric_logger(), + LogServerExperimentIdForUpload(std::string())); // Autofilled field EXPECT_CALL(*autofill_manager_->metric_logger(), LogQualityMetric(AutofillMetrics::FIELD_SUBMITTED, @@ -467,6 +471,8 @@ TEST_F(AutofillMetricsTest, QualityMetricsForFailure) { // Establish our expectations. ::testing::FLAGS_gmock_verbose = "error"; ::testing::InSequence dummy; + EXPECT_CALL(*autofill_manager_->metric_logger(), + LogServerExperimentIdForUpload(std::string())); for (size_t i = 0; i < ARRAYSIZE_UNSAFE(failure_cases); ++i) { EXPECT_CALL(*autofill_manager_->metric_logger(), LogQualityMetric(AutofillMetrics::FIELD_SUBMITTED, @@ -543,6 +549,8 @@ TEST_F(AutofillMetricsTest, SaneMetricsWithCacheMismatch) { ::testing::InSequence dummy; // New field EXPECT_CALL(*autofill_manager_->metric_logger(), + LogServerExperimentIdForUpload(std::string())); + EXPECT_CALL(*autofill_manager_->metric_logger(), LogQualityMetric(AutofillMetrics::FIELD_SUBMITTED, std::string())); EXPECT_CALL(*autofill_manager_->metric_logger(), @@ -731,6 +739,8 @@ TEST_F(AutofillMetricsTest, QualityMetricsWithExperimentId) { // Establish our expectations. ::testing::InSequence dummy; + EXPECT_CALL(*autofill_manager_->metric_logger(), + LogServerExperimentIdForUpload(experiment_id)); // Autofilled field EXPECT_CALL(*autofill_manager_->metric_logger(), LogQualityMetric(AutofillMetrics::FIELD_SUBMITTED, @@ -963,7 +973,7 @@ TEST_F(AutofillMetricsTest, CreditCardInfoBar) { } // Test that server query response experiment id metrics are logged correctly. -TEST_F(AutofillMetricsTest, ServerQueryExperimentId) { +TEST_F(AutofillMetricsTest, ServerQueryExperimentIdForQuery) { MockAutofillMetrics metric_logger; ::testing::InSequence dummy; @@ -973,7 +983,7 @@ TEST_F(AutofillMetricsTest, ServerQueryExperimentId) { EXPECT_CALL(metric_logger, LogServerQueryMetric(AutofillMetrics::QUERY_RESPONSE_PARSED)); EXPECT_CALL(metric_logger, - LogServerExperimentId(std::string())); + LogServerExperimentIdForQuery(std::string())); EXPECT_CALL(metric_logger, LogServerQueryMetric( AutofillMetrics::QUERY_RESPONSE_MATCHED_LOCAL_HEURISTICS)); @@ -987,7 +997,7 @@ TEST_F(AutofillMetricsTest, ServerQueryExperimentId) { EXPECT_CALL(metric_logger, LogServerQueryMetric(AutofillMetrics::QUERY_RESPONSE_PARSED)); EXPECT_CALL(metric_logger, - LogServerExperimentId("ar1")); + LogServerExperimentIdForQuery("ar1")); EXPECT_CALL(metric_logger, LogServerQueryMetric( AutofillMetrics::QUERY_RESPONSE_MATCHED_LOCAL_HEURISTICS)); diff --git a/chrome/browser/autofill/form_structure.cc b/chrome/browser/autofill/form_structure.cc index e7f4253..9d15c12 100644 --- a/chrome/browser/autofill/form_structure.cc +++ b/chrome/browser/autofill/form_structure.cc @@ -85,7 +85,8 @@ FormStructure::FormStructure(const FormData& form) source_url_(form.origin), target_url_(form.action), autofill_count_(0), - upload_required_(USE_UPLOAD_RATES) { + upload_required_(USE_UPLOAD_RATES), + server_experiment_id_("unknown experiment") { // Copy the form fields. std::vector<webkit_glue::FormField>::const_iterator field; for (field = form.fields.begin(); @@ -252,7 +253,7 @@ void FormStructure::ParseQueryResponse(const std::string& response_xml, return; metric_logger.LogServerQueryMetric(AutofillMetrics::QUERY_RESPONSE_PARSED); - metric_logger.LogServerExperimentId(experiment_id); + metric_logger.LogServerExperimentIdForQuery(experiment_id); bool heuristics_detected_fillable_field = false; bool query_response_overrode_heuristics = false; @@ -386,6 +387,8 @@ void FormStructure::UpdateFromCache(const FormStructure& cached_form) { void FormStructure::LogQualityMetrics( const AutofillMetrics& metric_logger) const { std::string experiment_id = server_experiment_id(); + metric_logger.LogServerExperimentIdForUpload(experiment_id); + for (size_t i = 0; i < field_count(); ++i) { const AutofillField* field = this->field(i); metric_logger.LogQualityMetric(AutofillMetrics::FIELD_SUBMITTED, |