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

Unified Diff: components/metrics/net/net_metrics_log_uploader.cc

Issue 1033493002: Histogram for UMA log upload connection type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment fix Created 5 years, 9 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 | net/base/network_change_notifier.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/metrics/net/net_metrics_log_uploader.cc
diff --git a/components/metrics/net/net_metrics_log_uploader.cc b/components/metrics/net/net_metrics_log_uploader.cc
index 1a686742e247a19f2b9659b589d78df39cf4c4de..cf50077370f813fe2727263de8f92a3bce10ee49 100644
--- a/components/metrics/net/net_metrics_log_uploader.cc
+++ b/components/metrics/net/net_metrics_log_uploader.cc
@@ -6,9 +6,23 @@
#include "base/metrics/histogram.h"
#include "net/base/load_flags.h"
+#include "net/base/network_change_notifier.h"
#include "net/url_request/url_fetcher.h"
#include "url/gurl.h"
+namespace {
+
+// Records the network connection type if upload was successful.
+void RecordConnectionType(int response_code) {
+ if (response_code == 200) {
+ UMA_HISTOGRAM_ENUMERATION("UMA.LogUpload.ConnetionType",
+ net::NetworkChangeNotifier::GetConnectionType(),
+ net::NetworkChangeNotifier::CONNECTION_LAST);
+ }
+}
+
+} // namespace
+
namespace metrics {
NetMetricsLogUploader::NetMetricsLogUploader(
@@ -54,6 +68,7 @@ void NetMetricsLogUploader::OnURLFetchComplete(const net::URLFetcher* source) {
if (response_code == net::URLFetcher::RESPONSE_CODE_INVALID)
response_code = -1;
current_fetch_.reset();
+ RecordConnectionType(response_code);
on_upload_complete_.Run(response_code);
}
« no previous file with comments | « no previous file | net/base/network_change_notifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698