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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.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
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.cc
index d1aac75d2d2a2bbc6c1d8c02402b639bddc68d57..a755e6de5983cddc1b8b5933a903a769ef98e271 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.cc
@@ -11,6 +11,8 @@
#include "base/metrics/sparse_histogram.h"
#include "base/prefs/pref_member.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h"
+#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h"
+#include "net/base/load_flags.h"
#include "net/base/net_errors.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_status_code.h"
@@ -121,10 +123,35 @@ void DataReductionProxyUsageStats::OnUrlRequestCompleted(
const net::URLRequest* request, bool started) {
DCHECK(thread_checker_.CalledOnValidThread());
- if (request->status().status() == net::URLRequestStatus::SUCCESS &&
- data_reduction_proxy_params_->WasDataReductionProxyUsed(request, NULL)) {
- successful_requests_through_proxy_count_++;
- NotifyUnavailabilityIfChanged();
+ DataReductionProxyTypeInfo proxy_info;
+ if (data_reduction_proxy_params_->WasDataReductionProxyUsed(request,
+ &proxy_info)) {
+ if (request->status().status() == net::URLRequestStatus::SUCCESS) {
+ successful_requests_through_proxy_count_++;
+ NotifyUnavailabilityIfChanged();
+ }
+
+ // Report any network errors that occurred for this request, including OK
+ // and ABORTED.
+ if (!proxy_info.is_fallback) {
+ UMA_HISTOGRAM_SPARSE_SLOWLY(
+ "DataReductionProxy.RequestCompletionErrorCodes.Primary",
+ std::abs(request->status().error()));
+ if (request->load_flags() & net::LOAD_MAIN_FRAME) {
+ UMA_HISTOGRAM_SPARSE_SLOWLY(
+ "DataReductionProxy.RequestCompletionErrorCodes.MainFrame.Primary",
+ std::abs(request->status().error()));
+ }
+ } else {
+ UMA_HISTOGRAM_SPARSE_SLOWLY(
+ "DataReductionProxy.RequestCompletionErrorCodes.Fallback",
+ std::abs(request->status().error()));
+ if (request->load_flags() & net::LOAD_MAIN_FRAME) {
+ UMA_HISTOGRAM_SPARSE_SLOWLY(
+ "DataReductionProxy.RequestCompletionErrorCodes.MainFrame.Fallback",
+ std::abs(request->status().error()));
+ }
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698