summaryrefslogtreecommitdiff
path: root/chromium/components/data_reduction_proxy/core/browser/data_reduction_proxy_metrics.h
blob: d06dd623100f2d500e16289393c44f3925e76fa5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_METRICS_H_
#define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_METRICS_H_

#include <vector>

namespace net {
class ProxyConfig;
class URLRequest;
}

namespace data_reduction_proxy {

class DataReductionProxyConfig;

typedef std::vector<long long> ContentLengthList;

// A bypass delay more than this is treated as a long delay.
const int kLongBypassDelayInSeconds = 30 * 60;

// The number of days of bandwidth usage statistics that are tracked.
const unsigned int kNumDaysInHistory = 60;

// The number of days of bandwidth usage statistics that are presented.
const unsigned int kNumDaysInHistorySummary = 30;

static_assert(kNumDaysInHistorySummary <= kNumDaysInHistory,
              "kNumDaysInHistorySummary should be no larger than "
              "kNumDaysInHistory");

enum DataReductionProxyRequestType {
  VIA_DATA_REDUCTION_PROXY,  // A request served by the data reduction proxy.
  // Below are reasons why a request is not served by the enabled data reduction
  // proxy. Off-the-record profile data is not counted in all cases.
  HTTPS,         // An https request.
  SHORT_BYPASS,  // The client is bypassed by the proxy for a short time.
  LONG_BYPASS,   // The client is bypassed by the proxy for a long time (due
                 // to country bypass policy, for example).
  UPDATE,        // An update to already counted request data.
  DIRECT_HTTP,   // An http request with a disabled data reduction proxy.
  UNKNOWN_TYPE,  // Any other reason not listed above.
};

// Returns DataReductionProxyRequestType for |request|.
DataReductionProxyRequestType GetDataReductionProxyRequestType(
    const net::URLRequest& request,
    const net::ProxyConfig& proxy_config,
    const DataReductionProxyConfig& data_reduction_proxy_config);

}  // namespace data_reduction_proxy

#endif  // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_METRICS_H_