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

Unified Diff: components/domain_reliability/uploader.cc

Issue 694573003: Domain Reliability: Histogram net error codes from uploads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Label upload response code histogram with an enum Created 6 years, 2 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/domain_reliability/uploader.cc
diff --git a/components/domain_reliability/uploader.cc b/components/domain_reliability/uploader.cc
index 10084569a302b26948e6ad2656d9508a83e029ed..6a9716394a8130dae404f92b267bab54fbe2c180 100644
--- a/components/domain_reliability/uploader.cc
+++ b/components/domain_reliability/uploader.cc
@@ -11,6 +11,7 @@
#include "base/stl_util.h"
#include "base/supports_user_data.h"
#include "net/base/load_flags.h"
+#include "net/base/net_errors.h"
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_fetcher_delegate.h"
#include "net/url_request/url_request_context_getter.h"
@@ -93,13 +94,36 @@ class DomainReliabilityUploaderImpl
UploadCallbackMap::iterator callback_it = upload_callbacks_.find(fetcher);
DCHECK(callback_it != upload_callbacks_.end());
- VLOG(1) << "Upload finished with " << fetcher->GetResponseCode();
+ int net_error;
+ {
+ const net::URLRequestStatus& status = fetcher->GetStatus();
+ switch (status.status()) {
+ case net::URLRequestStatus::SUCCESS:
+ net_error = net::OK;
+ break;
+ case net::URLRequestStatus::CANCELED:
+ net_error = net::ERR_ABORTED;
+ break;
+ case net::URLRequestStatus::FAILED:
+ net_error = status.error();
+ break;
+ default:
+ NOTREACHED();
+ net_error = net::ERR_FAILED;
+ break;
+ }
+ }
+ int http_response_code = fetcher->GetResponseCode();
+
+ VLOG(1) << "Upload finished with net error " << net_error <<
+ " and HTTP response code " << http_response_code;
UMA_HISTOGRAM_SPARSE_SLOWLY("DomainReliability.UploadResponseCode",
- fetcher->GetResponseCode());
+ http_response_code);
+ UMA_HISTOGRAM_SPARSE_SLOWLY("DomainReliability.UploadNetError",
+ -net_error);
- bool success = fetcher->GetResponseCode() == 200;
- callback_it->second.Run(success);
+ callback_it->second.Run(http_response_code == 200);
delete callback_it->first;
upload_callbacks_.erase(callback_it);
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698