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

Unified Diff: chrome/browser/net/chrome_network_delegate.cc

Issue 784253002: Measure network error rates with and without data reduction proxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 6 years 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 | components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/chrome_network_delegate.cc
diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc
index 5a79df93a6a956d70f40f44c0d29fd73f1467289..563a4be74e816d2d17e499120a2386a1844a114b 100644
--- a/chrome/browser/net/chrome_network_delegate.cc
+++ b/chrome/browser/net/chrome_network_delegate.cc
@@ -15,6 +15,7 @@
#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "base/metrics/histogram.h"
+#include "base/metrics/sparse_histogram.h"
#include "base/metrics/user_metrics.h"
#include "base/path_service.h"
#include "base/prefs/pref_member.h"
@@ -40,6 +41,7 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/resource_request_info.h"
#include "net/base/host_port_pair.h"
+#include "net/base/load_flags.h"
#include "net/base/net_errors.h"
#include "net/base/net_log.h"
#include "net/cookies/canonical_cookie.h"
@@ -150,6 +152,21 @@ void ReportInvalidReferrerSend(const GURL& target_url,
NOTREACHED();
}
+// Record network errors that HTTP requests complete with, including OK and
+// ABORTED.
+void RecordNetworkErrorHistograms(const net::URLRequest* request) {
+ if (request->url().SchemeIs("http")) {
+ UMA_HISTOGRAM_SPARSE_SLOWLY("Net.HttpRequestCompletionErrorCodes",
+ std::abs(request->status().error()));
+
+ if (request->load_flags() & net::LOAD_MAIN_FRAME) {
+ UMA_HISTOGRAM_SPARSE_SLOWLY(
+ "Net.HttpRequestCompletionErrorCodes.MainFrame",
+ std::abs(request->status().error()));
+ }
+ }
+}
+
} // namespace
ChromeNetworkDelegate::ChromeNetworkDelegate(
@@ -385,6 +402,8 @@ void ChromeNetworkDelegate::OnRawBytesRead(const net::URLRequest& request,
void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request,
bool started) {
+ RecordNetworkErrorHistograms(request);
+
TRACE_EVENT_ASYNC_END0("net", "URLRequest", request);
if (request->status().status() == net::URLRequestStatus::SUCCESS) {
#if defined(OS_ANDROID)
« no previous file with comments | « no previous file | components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698