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

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

Issue 1048303004: Added new BypassedBytes.Current histograms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments 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
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.cc
index bef98bf0bea26a075368a4912ea803f8f0d0669a..cd4ce095d929e1283304f3b4d3d5b75af809f799 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.cc
@@ -289,26 +289,37 @@ void DataReductionProxyBypassStats::RecordBypassedBytesHistograms(
return;
}
+ std::string mime_type;
+ request.GetMimeType(&mime_type);
+ // MIME types are named by <media-type>/<subtype>. Check to see if the media
+ // type is audio or video in order to record audio/video bypasses separately
+ // for current bypasses and for the triggering requests of short bypasses.
+ if ((last_bypass_type_ == BYPASS_EVENT_TYPE_CURRENT ||
+ (triggering_request_ && last_bypass_type_ == BYPASS_EVENT_TYPE_SHORT)) &&
+ (mime_type.compare(0, 6, "audio/") == 0 ||
+ mime_type.compare(0, 6, "video/") == 0)) {
+ RecordBypassedBytes(last_bypass_type_,
+ DataReductionProxyBypassStats::AUDIO_VIDEO,
+ content_length);
+ triggering_request_ = false;
+ return;
+ }
+
+ // Report current bypasses of MIME type "application/octet-stream" separately.
+ if (last_bypass_type_ == BYPASS_EVENT_TYPE_CURRENT &&
+ mime_type.find("application/octet-stream") != std::string::npos) {
+ RecordBypassedBytes(last_bypass_type_,
+ DataReductionProxyBypassStats::APPLICATION_OCTET_STREAM,
+ content_length);
+ return;
+ }
+
// Only record separate triggering request UMA for short, medium, and long
// bypass events.
if (triggering_request_ &&
(last_bypass_type_ == BYPASS_EVENT_TYPE_SHORT ||
last_bypass_type_ == BYPASS_EVENT_TYPE_MEDIUM ||
last_bypass_type_ == BYPASS_EVENT_TYPE_LONG)) {
- std::string mime_type;
- request.GetMimeType(&mime_type);
- // MIME types are named by <media-type>/<subtype>. Check to see if the
- // media type is audio or video. Only record when triggered by short bypass,
- // there isn't an audio or video bucket for medium or long bypasses.
- if (last_bypass_type_ == BYPASS_EVENT_TYPE_SHORT &&
- (mime_type.compare(0, 6, "audio/") == 0 ||
- mime_type.compare(0, 6, "video/") == 0)) {
- RecordBypassedBytes(last_bypass_type_,
- DataReductionProxyBypassStats::AUDIO_VIDEO,
- content_length);
- return;
- }
-
RecordBypassedBytes(last_bypass_type_,
DataReductionProxyBypassStats::TRIGGERING_REQUEST,
content_length);
@@ -415,10 +426,30 @@ void DataReductionProxyBypassStats::RecordBypassedBytes(
content_length);
break;
case DataReductionProxyBypassStats::AUDIO_VIDEO:
- if (last_bypass_type_ == BYPASS_EVENT_TYPE_SHORT) {
- UMA_HISTOGRAM_COUNTS(
- "DataReductionProxy.BypassedBytes.ShortAudioVideo",
- content_length);
+ switch (bypass_type) {
+ case BYPASS_EVENT_TYPE_CURRENT:
+ UMA_HISTOGRAM_COUNTS(
+ "DataReductionProxy.BypassedBytes.CurrentAudioVideo",
+ content_length);
+ break;
+ case BYPASS_EVENT_TYPE_SHORT:
+ UMA_HISTOGRAM_COUNTS(
+ "DataReductionProxy.BypassedBytes.ShortAudioVideo",
+ content_length);
+ break;
+ default:
+ NOTREACHED();
+ }
+ break;
+ case DataReductionProxyBypassStats::APPLICATION_OCTET_STREAM:
+ switch (bypass_type) {
+ case BYPASS_EVENT_TYPE_CURRENT:
+ UMA_HISTOGRAM_COUNTS(
+ "DataReductionProxy.BypassedBytes.CurrentApplicationOctetStream",
+ content_length);
+ break;
+ default:
+ NOTREACHED();
}
break;
case DataReductionProxyBypassStats::TRIGGERING_REQUEST:

Powered by Google App Engine
This is Rietveld 408576698