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

Unified Diff: components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h

Issue 577343002: Adds UMA to measure when the data reduction proxy via header is missing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments 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 side-by-side diff with in-line comments
Download patch
Index: components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h b/components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h
index 33fd29e560fa2f533fa044f1c3be60a83537c599..b78837d64277edafa21e95a7aa134b6388ca59a2 100644
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h
@@ -16,7 +16,9 @@
#include "net/url_request/url_request.h"
namespace net {
+class ProxyConfig;
class ProxyServer;
+class HttpResponseHeaders;
bengr 2014/09/22 19:36:16 Alphabetize forward declarations.
sclittle 2014/09/22 20:54:25 Done.
}
namespace data_reduction_proxy {
@@ -33,6 +35,12 @@ class DataReductionProxyUsageStats
const net::ProxyServer& proxy_server,
DataReductionProxyBypassType bypass_type);
+ // For the given response |headers| that are expected to include the data
+ // reduction proxy via header, records response code UMA if the data reduction
+ // proxy via header is not present.
+ static void DetectAndRecordMissingViaHeaderResponseCode(
+ bool is_primary, const net::HttpResponseHeaders* headers);
+
// MessageLoopProxy instance is owned by io_thread. |params| outlives
// this class instance.
DataReductionProxyUsageStats(DataReductionProxyParams* params,
@@ -55,10 +63,19 @@ class DataReductionProxyUsageStats
// cause the current bypass.
void SetBypassType(DataReductionProxyBypassType type);
+ // Records all the data reduction proxy bytes-related histograms for the
+ // completed URLRequest |request|.
+ void RecordBytesHistograms(
+ net::URLRequest& request,
bengr 2014/09/22 19:36:16 Don't use non-const refs.
sclittle 2014/09/22 20:54:25 Done. I'll change RecordBypassedBytesHistograms as
+ const BooleanPrefMember& data_reduction_proxy_enabled,
+ const net::ProxyConfig& data_reduction_proxy_config);
+
// Given |data_reduction_proxy_enabled|, a |request|, and the
// |data_reduction_proxy_config| records the number of bypassed bytes for that
// |request| into UMAs based on bypass type. |data_reduction_proxy_enabled|
// tells us the state of the kDataReductionProxyEnabled preference.
+ // This method is publicly visible for testing purposes; use the method
+ // RecordBytesHistograms instead of calling this method directly.
bengr 2014/09/22 19:36:16 As discussed, please just friend the tests.
sclittle 2014/09/22 20:54:25 Done.
void RecordBypassedBytesHistograms(
net::URLRequest& request,
const BooleanPrefMember& data_reduction_proxy_enabled,
@@ -67,6 +84,13 @@ class DataReductionProxyUsageStats
void RecordBypassEventHistograms(const net::ProxyServer& bypassed_proxy,
int net_error) const;
+ // Records UMA of the number of response bytes of responses that are expected
+ // to have the data reduction proxy via header, but where the data reduction
+ // proxy via header is not present.
+ // This method is publicly visible for testing purposes; use the method
+ // RecordBytesHistograms instead of calling this method directly.
+ void RecordMissingViaHeaderBytes(net::URLRequest& request);
bengr 2014/09/22 19:36:16 Don't use non-const refs.
sclittle 2014/09/22 20:54:25 Done.
+
private:
enum BypassedBytesType {
NOT_BYPASSED = 0, /* Not bypassed. */

Powered by Google App Engine
This is Rietveld 408576698