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

Side by Side Diff: components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.cc

Issue 566943004: DataReductionProxy.BypassedBytes.* counts all triggering request bytes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and rebase Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_usage_sta ts.h" 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_usage_sta ts.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 191
192 if (data_reduction_proxy_enabled.GetValue() && 192 if (data_reduction_proxy_enabled.GetValue() &&
193 data_reduction_proxy_params_->IsBypassedByDataReductionProxyLocalRules( 193 data_reduction_proxy_params_->IsBypassedByDataReductionProxyLocalRules(
194 request, data_reduction_proxy_config)) { 194 request, data_reduction_proxy_config)) {
195 RecordBypassedBytes(last_bypass_type_, 195 RecordBypassedBytes(last_bypass_type_,
196 DataReductionProxyUsageStats::LOCAL_BYPASS_RULES, 196 DataReductionProxyUsageStats::LOCAL_BYPASS_RULES,
197 content_length); 197 content_length);
198 return; 198 return;
199 } 199 }
200 200
201 if (triggering_request_) { 201 // Only record separate triggering request UMA for short, medium, and long
202 // We only record when audio or video triggers a bypass. We don't care 202 // bypass events.
203 // about audio and video bypassed as collateral damage. 203 if (triggering_request_ &&
204 (last_bypass_type_ == BYPASS_EVENT_TYPE_SHORT ||
205 last_bypass_type_ == BYPASS_EVENT_TYPE_MEDIUM ||
206 last_bypass_type_ == BYPASS_EVENT_TYPE_LONG)) {
204 std::string mime_type; 207 std::string mime_type;
205 request.GetMimeType(&mime_type); 208 request.GetMimeType(&mime_type);
206 // MIME types are named by <media-type>/<subtype>. We check to see if the 209 // MIME types are named by <media-type>/<subtype>. Check to see if the
207 // media type is audio or video. 210 // media type is audio or video. Only record when triggered by short bypass,
208 if (mime_type.compare(0, 6, "audio/") == 0 || 211 // there isn't an audio or video bucket for medium or long bypasses.
209 mime_type.compare(0, 6, "video/") == 0) { 212 if (last_bypass_type_ == BYPASS_EVENT_TYPE_SHORT &&
213 (mime_type.compare(0, 6, "audio/") == 0 ||
214 mime_type.compare(0, 6, "video/") == 0)) {
210 RecordBypassedBytes(last_bypass_type_, 215 RecordBypassedBytes(last_bypass_type_,
211 DataReductionProxyUsageStats::AUDIO_VIDEO, 216 DataReductionProxyUsageStats::AUDIO_VIDEO,
212 content_length); 217 content_length);
213 return; 218 return;
214 } 219 }
215 220
216 RecordBypassedBytes(last_bypass_type_, 221 RecordBypassedBytes(last_bypass_type_,
217 DataReductionProxyUsageStats::TRIGGERING_REQUEST, 222 DataReductionProxyUsageStats::TRIGGERING_REQUEST,
218 content_length); 223 content_length);
219 triggering_request_ = false; 224 triggering_request_ = false;
220 return; 225 return;
221 } 226 }
222 227
223 if (last_bypass_type_ != BYPASS_EVENT_TYPE_MAX) { 228 if (last_bypass_type_ != BYPASS_EVENT_TYPE_MAX) {
224 RecordBypassedBytes(last_bypass_type_, 229 RecordBypassedBytes(last_bypass_type_,
225 DataReductionProxyUsageStats::BYPASSED_BYTES_TYPE_MAX, 230 DataReductionProxyUsageStats::BYPASSED_BYTES_TYPE_MAX,
226 content_length); 231 content_length);
227 return; 232 return;
228 } 233 }
229 234
230 if (data_reduction_proxy_params_-> 235 if (data_reduction_proxy_params_->AreDataReductionProxiesBypassed(request,
231 AreDataReductionProxiesBypassed(request, NULL)) { 236 NULL)) {
232 RecordBypassedBytes(last_bypass_type_, 237 RecordBypassedBytes(last_bypass_type_,
233 DataReductionProxyUsageStats::NETWORK_ERROR, 238 DataReductionProxyUsageStats::NETWORK_ERROR,
234 content_length); 239 content_length);
235 } 240 }
236 } 241 }
237 242
238 void DataReductionProxyUsageStats::RecordBypassEventHistograms( 243 void DataReductionProxyUsageStats::RecordBypassEventHistograms(
239 const net::ProxyServer& bypassed_proxy, 244 const net::ProxyServer& bypassed_proxy,
240 int net_error) const { 245 int net_error) const {
241 DataReductionProxyTypeInfo data_reduction_proxy_info; 246 DataReductionProxyTypeInfo data_reduction_proxy_info;
242 if (bypassed_proxy.is_valid() && !bypassed_proxy.is_direct() && 247 if (bypassed_proxy.is_valid() && !bypassed_proxy.is_direct() &&
243 data_reduction_proxy_params_->IsDataReductionProxy( 248 data_reduction_proxy_params_->IsDataReductionProxy(
244 bypassed_proxy.host_port_pair(), &data_reduction_proxy_info)) { 249 bypassed_proxy.host_port_pair(), &data_reduction_proxy_info)) {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 default: 374 default:
370 break; 375 break;
371 } 376 }
372 break; 377 break;
373 } 378 }
374 } 379 }
375 380
376 } // namespace data_reduction_proxy 381 } // namespace data_reduction_proxy
377 382
378 383
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698