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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc

Issue 2804113004: Add UMA to break down data usage by http/https and video/non_video (Closed)
Patch Set: formatting Created 3 years, 8 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
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc
index 26385ac33de980c2d960bf8e0bae5f6c28fa81db..6674b272cfecc95d169e765e7778e4251fb43a64 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc
@@ -23,6 +23,7 @@
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_util.h"
#include "components/data_reduction_proxy/core/common/lofi_decider.h"
#include "net/base/load_flags.h"
+#include "net/base/mime_util.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_response_headers.h"
#include "net/nqe/network_quality_estimator.h"
@@ -46,6 +47,8 @@ namespace {
// |freshness_lifetime| contains information on how long the resource will be
// fresh for and how long is the usability.
void RecordContentLengthHistograms(bool lofi_low_header_added,
+ bool is_https_request,
+ bool is_video,
int64_t received_content_length,
int64_t original_content_length,
const base::TimeDelta& freshness_lifetime) {
@@ -75,6 +78,16 @@ void RecordContentLengthHistograms(bool lofi_low_header_added,
original_content_length = received_content_length;
}
UMA_HISTOGRAM_COUNTS("Net.HttpContentLength", received_content_length);
+ if (is_https_request) {
+ UMA_HISTOGRAM_COUNTS("Net.HttpContentLength.Https",
Alexei Svitkine (slow) 2017/04/11 18:44:12 UMA_HISTOGRAM_COUNTS is deprecated and we prefer n
ajo1 2017/04/11 20:00:25 Done.
+ received_content_length);
+ } else {
+ UMA_HISTOGRAM_COUNTS("Net.HttpContentLength.Http", received_content_length);
+ }
+ if (is_video) {
+ UMA_HISTOGRAM_COUNTS("Net.HttpContentLength.Video",
+ received_content_length);
+ }
UMA_HISTOGRAM_COUNTS("Net.HttpOriginalContentLength",
original_content_length);
UMA_HISTOGRAM_COUNTS("Net.HttpContentLengthDifference",
@@ -411,12 +424,21 @@ void DataReductionProxyNetworkDelegate::RecordContentLength(
->GetFreshnessLifetimes(request.response_info().response_time)
.freshness;
+ bool is_https_request = request.url().SchemeIs("https");
+ bool is_video_response = false;
+ if (request.response_headers()) {
+ std::string mime_type;
+ request.response_headers()->GetMimeType(&mime_type);
+ is_video_response = net::MatchesMimeType("video/*", mime_type);
+ }
+
RecordContentLengthHistograms(
// |data_reduction_proxy_io_data_| can be NULL for Webview.
data_reduction_proxy_io_data_ &&
data_reduction_proxy_io_data_->IsEnabled() &&
data_reduction_proxy_io_data_->lofi_decider() &&
data_reduction_proxy_io_data_->lofi_decider()->IsUsingLoFi(request),
+ is_https_request, is_video_response,
request.received_response_content_length(), original_content_length,
freshness_lifetime);

Powered by Google App Engine
This is Rietveld 408576698