Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(911)

Unified Diff: components/autofill/browser/autocheckout/whitelist_manager.cc

Issue 14060013: Add UMA stats to track whitelist download latency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/autofill/browser/autocheckout/whitelist_manager.cc
diff --git a/components/autofill/browser/autocheckout/whitelist_manager.cc b/components/autofill/browser/autocheckout/whitelist_manager.cc
index aeb60f113393bfbe12ee93af31708c6632f2588a..5b9891316fb63143f4938b4f03e824c6ce38fa09 100644
--- a/components/autofill/browser/autocheckout/whitelist_manager.cc
+++ b/components/autofill/browser/autocheckout/whitelist_manager.cc
@@ -77,6 +77,8 @@ void WhitelistManager::StartDownloadTimer(size_t interval_seconds) {
void WhitelistManager::TriggerDownload() {
callback_is_pending_ = true;
+ request_started_timestamp_ = base::Time::Now();
+
request_.reset(net::URLFetcher::Create(
0, GURL(kWhitelistUrl), net::URLFetcher::GET, this));
request_->SetRequestContext(context_getter_);
@@ -99,9 +101,16 @@ void WhitelistManager::OnURLFetchComplete(
DCHECK_EQ(source, old_request.get());
if (source->GetResponseCode() == net::HTTP_OK) {
+ GetMetricLogger().LogAutocheckoutWhitelistDownloadDuration(
+ base::Time::Now() - request_started_timestamp_,
+ AutofillMetrics::WHITELIST_DOWNLOAD_SUCCEEDED);
std::string data;
source->GetResponseAsString(&data);
BuildWhitelist(data);
+ } else {
+ GetMetricLogger().LogAutocheckoutWhitelistDownloadDuration(
+ base::Time::Now() - request_started_timestamp_,
+ AutofillMetrics::WHITELIST_DOWNLOAD_FAILED);
Ilya Sherman 2013/04/17 00:18:01 nit: Would be nice to move most of this code out o
benquan 2013/04/17 01:51:30 In the If block, I want to track UMA before callin
Ilya Sherman 2013/04/17 05:01:48 You can compute the duration outside of the if/els
benquan 2013/04/17 05:48:18 Done.
}
ScheduleDownload(kDownloadIntervalSeconds);

Powered by Google App Engine
This is Rietveld 408576698