OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "net/reporting/reporting_metrics.h" | |
6 | |
7 #include "base/metrics/histogram_macros.h" | |
8 | |
9 namespace net { | |
10 | |
11 void HistogramEnabledState(EnabledState state) { | |
12 DCHECK_NE(ENABLED_STATE_MAX, state); | |
13 UMA_HISTOGRAM_ENUMERATION("Reporting.EnabledState", state, ENABLED_STATE_MAX); | |
14 } | |
15 | |
16 void HistogramHeader(HeaderFate fate) { | |
17 DCHECK_NE(HEADER_FATE_MAX, fate); | |
Ryan Sleevi
2017/01/03 21:28:13
All of these DCHECKs are arguably unnecessary
I a
Julia Tuttle
2017/01/25 20:27:45
Done.
| |
18 UMA_HISTOGRAM_ENUMERATION("Reporting.HeaderFate", fate, HEADER_FATE_MAX); | |
19 } | |
20 | |
21 void HistogramHeaderEndpoint(HeaderEndpointFate fate, base::TimeDelta ttl) { | |
22 DCHECK_NE(HEADER_ENDPOINT_FATE_MAX, fate); | |
23 UMA_HISTOGRAM_ENUMERATION("Reporting.HeaderEndpointFate", fate, | |
24 HEADER_ENDPOINT_FATE_MAX); | |
25 if (ttl > base::TimeDelta()) { | |
Ryan Sleevi
2017/01/03 21:28:13
This is subtle and under-documented (in your desig
Julia Tuttle
2017/01/25 20:27:45
I'm not defending against a negative TTL; I'm diff
| |
26 UMA_HISTOGRAM_CUSTOM_TIMES("Reporting.HeaderEndpointTTL", ttl, | |
27 base::TimeDelta::FromSeconds(1), | |
28 base::TimeDelta::FromDays(7), 100); | |
29 } | |
30 } | |
31 | |
32 void HistogramClient(base::TimeDelta ttl) { | |
33 UMA_HISTOGRAM_CUSTOM_TIMES("Reporting.ClientTTL", ttl, | |
34 base::TimeDelta::FromSeconds(1), | |
35 base::TimeDelta::FromDays(7), 100); | |
36 } | |
37 | |
38 void HistogramReport(ReportFate fate, base::TimeDelta latency, int attempts) { | |
39 DCHECK_NE(REPORT_FATE_MAX, fate); | |
40 UMA_HISTOGRAM_ENUMERATION("Reporting.ReportFate", fate, REPORT_FATE_MAX); | |
41 if (fate == REPORT_FATE_DELIVERED) { | |
42 UMA_HISTOGRAM_LONG_TIMES("Reporting.ReportDeliveredAfterTime", latency); | |
43 UMA_HISTOGRAM_EXACT_LINEAR("Reporting.ReportDeliveredAfterAttempts", | |
44 attempts, 10); | |
45 } | |
46 } | |
47 | |
48 void HistogramDeliveryContent(int report_count, int byte_count) { | |
49 UMA_HISTOGRAM_COUNTS_100("Reporting.DeliveryReportCount", report_count); | |
50 UMA_HISTOGRAM_COUNTS_100000("Reporting.DeliveryByteCount", byte_count); | |
Ryan Sleevi
2017/01/03 21:28:13
I'm very skeptical of a lot of these metrics, and
Julia Tuttle
2017/01/25 20:27:45
Alright, let me give it some thought.
The ones I'
| |
51 } | |
52 | |
53 void HistogramDeliveryOutcome(DeliveryFate fate, | |
54 int net_error, | |
55 int http_response_code) { | |
56 DCHECK_NE(DELIVERY_FATE_MAX, fate); | |
57 UMA_HISTOGRAM_ENUMERATION("Reporting.DeliveryFate", fate, DELIVERY_FATE_MAX); | |
58 if (fate != DELIVERY_FATE_SHUTDOWN) { | |
59 UMA_HISTOGRAM_SPARSE_SLOWLY("Reporting.DeliveryNetError", net_error); | |
60 if (http_response_code > 0) { | |
61 UMA_HISTOGRAM_SPARSE_SLOWLY("Reporting.DeliveryHttpResponseCode", | |
62 http_response_code); | |
63 } | |
64 } | |
65 } | |
66 | |
67 void HistogramEndpoint(EndpointFate fate) { | |
68 UMA_HISTOGRAM_ENUMERATION("Reporting.EndpointFate", fate, ENDPOINT_FATE_MAX); | |
69 } | |
70 | |
71 } // namespace net | |
OLD | NEW |