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

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: Recording ConnectionType histogram in NetMetricsLogUploader 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 | tools/metrics/histograms/histograms.xml » ('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..42a6c7103c0246a3e92db5f81b7f092aede4ccbb 100644
--- a/components/metrics/net/net_metrics_log_uploader.cc
+++ b/components/metrics/net/net_metrics_log_uploader.cc
@@ -6,9 +6,22 @@
#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);
Ilya Sherman 2015/03/25 23:10:00 If you reuse this enum, please add a comment above
gayane -on leave until 09-2017 2015/03/26 17:41:27 Done.
+ }
+}
Ilya Sherman 2015/03/25 23:10:00 nit: Please leave a blank line after this one.
gayane -on leave until 09-2017 2015/03/26 17:41:27 Done.
+}
Ilya Sherman 2015/03/25 23:10:00 nit: Please add a comment " // namespace"
gayane -on leave until 09-2017 2015/03/26 17:41:27 Done.
+
namespace metrics {
NetMetricsLogUploader::NetMetricsLogUploader(
@@ -54,6 +67,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 | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698