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

Side by Side Diff: components/rappor/rappor_parameters.h

Issue 1921533004: Add a low-frequency RAPPOR configuration, and use it for Safe Browsing and Permissions metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing nits Created 4 years, 7 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
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 #ifndef COMPONENTS_RAPPOR_RAPPOR_PARAMETERS_H_ 5 #ifndef COMPONENTS_RAPPOR_RAPPOR_PARAMETERS_H_
6 #define COMPONENTS_RAPPOR_RAPPOR_PARAMETERS_H_ 6 #define COMPONENTS_RAPPOR_RAPPOR_PARAMETERS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 namespace rappor { 10 namespace rappor {
11 11
12 // Levels of noise added to a sample. 12 // Levels of noise added to a sample.
13 enum NoiseLevel { 13 enum NoiseLevel {
14 NO_NOISE = 0, 14 NO_NOISE = 0,
15 NORMAL_NOISE, 15 NORMAL_NOISE,
16 SPARSE_NOISE,
16 NUM_NOISE_LEVELS, 17 NUM_NOISE_LEVELS,
17 }; 18 };
18 19
19 // The type of data stored in a metric. 20 // The type of data stored in a metric.
21 // Any use of the LOW_FREQUENCY types must be approved by Chrome Privacy and
22 // the rappor-dev team.
20 enum RapporType { 23 enum RapporType {
21 // Generic metrics from UMA opt-in users. 24 // Generic metrics from UMA opt-in users.
22 UMA_RAPPOR_TYPE = 0, 25 UMA_RAPPOR_TYPE = 0,
23 // Generic metrics for SafeBrowsing users. 26 // Generic metrics for SafeBrowsing users. Deprecated, replaced by
27 // LOW_FREQUENCY_SAFEBROWSING_RAPPOR_TYPE.
24 SAFEBROWSING_RAPPOR_TYPE, 28 SAFEBROWSING_RAPPOR_TYPE,
25 // Deprecated: Use UMA_RAPPOR_TYPE for new metrics 29 // Deprecated: Use UMA_RAPPOR_TYPE for new metrics
26 ETLD_PLUS_ONE_RAPPOR_TYPE, 30 ETLD_PLUS_ONE_RAPPOR_TYPE,
31 // Type for low-frequency metrics from UMA opt-in users.
32 LOW_FREQUENCY_UMA_RAPPOR_TYPE,
33 // Type for low-frequency metrics from SafeBrowsing users.
34 LOW_FREQUENCY_SAFEBROWSING_RAPPOR_TYPE,
35 // Type for low-frequency metrics from UMA opt-in users. Do not use for new
36 // metrics.
37 LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE,
27 NUM_RAPPOR_TYPES, 38 NUM_RAPPOR_TYPES,
28 COARSE_RAPPOR_TYPE = SAFEBROWSING_RAPPOR_TYPE, 39 COARSE_RAPPOR_TYPE = SAFEBROWSING_RAPPOR_TYPE,
29 }; 40 };
30 41
31 enum Probability { 42 enum Probability {
32 PROBABILITY_100, // 100% 43 PROBABILITY_100, // 100%
33 PROBABILITY_75, // 75% 44 PROBABILITY_75, // 75%
34 PROBABILITY_50, // 50% 45 PROBABILITY_50, // 50%
35 PROBABILITY_25, // 25% 46 PROBABILITY_25, // 25%
36 PROBABILITY_0, // 0% 47 PROBABILITY_0, // 0%
37 }; 48 };
38 49
39 50
40 // A metric is reported when its reporting group is in the set of groups 51 // A metric is reported when its reporting group is in the set of groups
41 // passed in to RapporService::Start() 52 // passed in to RapporService::Start()
42 enum RecordingGroup { 53 enum RecordingGroup {
43 // Metrics for UMA users. 54 // Metrics for UMA users.
44 UMA_RAPPOR_GROUP = 1 << 0, 55 UMA_RAPPOR_GROUP = 1 << 0,
45 // Metrics related to SafeBrowsing, for SafeBrowsing users. 56 // Metrics related to SafeBrowsing, for SafeBrowsing users.
46 SAFEBROWSING_RAPPOR_GROUP = 1 << 1, 57 SAFEBROWSING_RAPPOR_GROUP = 1 << 1,
47 }; 58 };
48 59
49 60
50 // An object describing noise probabilities for a noise level 61 // An object describing noise probabilities for a noise level
51 struct NoiseParameters { 62 struct NoiseParameters {
52 // The probability that a bit will be redacted with fake data. 63 // The probability that a bit will be redacted with fake data. This
64 // corresponds to the F privacy parameter.
53 Probability fake_prob; 65 Probability fake_prob;
54 // The probability that a fake bit will be a one. 66 // The probability that a fake bit will be a one.
55 Probability fake_one_prob; 67 Probability fake_one_prob;
56 // The probability that a one bit in the redacted data reports as one. 68 // The probability that a one bit in the redacted data reports as one. This
69 // corresponds to the Q privacy parameter
57 Probability one_coin_prob; 70 Probability one_coin_prob;
58 // The probability that a zero bit in the redacted data reports as one. 71 // The probability that a zero bit in the redacted data reports as one. This
72 // corresponds to the P privacy parameter.
59 Probability zero_coin_prob; 73 Probability zero_coin_prob;
60 }; 74 };
61 75
62 // An object describing a rappor metric and the parameters used to generate it. 76 // An object describing a rappor metric and the parameters used to generate it.
63 // 77 //
64 // For a full description of the rappor metrics, see 78 // For a full description of the rappor metrics, see
65 // http://www.chromium.org/developers/design-documents/rappor 79 // http://www.chromium.org/developers/design-documents/rappor
66 struct RapporParameters { 80 struct RapporParameters {
67 // Get a string representing the parameters, for DCHECK_EQ. 81 // Get a string representing the parameters, for DCHECK_EQ.
68 std::string ToString() const; 82 std::string ToString() const;
(...skipping 28 matching lines...) Expand all
97 rappor::PROBABILITY_100 /* One coin probability */, 111 rappor::PROBABILITY_100 /* One coin probability */,
98 rappor::PROBABILITY_0 /* Zero coin probability */, 112 rappor::PROBABILITY_0 /* Zero coin probability */,
99 }, 113 },
100 // NORMAL_NOISE 114 // NORMAL_NOISE
101 { 115 {
102 rappor::PROBABILITY_50 /* Fake data probability */, 116 rappor::PROBABILITY_50 /* Fake data probability */,
103 rappor::PROBABILITY_50 /* Fake one probability */, 117 rappor::PROBABILITY_50 /* Fake one probability */,
104 rappor::PROBABILITY_75 /* One coin probability */, 118 rappor::PROBABILITY_75 /* One coin probability */,
105 rappor::PROBABILITY_25 /* Zero coin probability */, 119 rappor::PROBABILITY_25 /* Zero coin probability */,
106 }, 120 },
121 // SPARSE_NOISE
122 {
123 rappor::PROBABILITY_25 /* Fake data probability */,
124 rappor::PROBABILITY_50 /* Fake one probability */,
125 rappor::PROBABILITY_75 /* One coin probability */,
126 rappor::PROBABILITY_25 /* Zero coin probability */,
127 },
107 }; 128 };
108 129
109 const RapporParameters kRapporParametersForType[NUM_RAPPOR_TYPES] = { 130 const RapporParameters kRapporParametersForType[NUM_RAPPOR_TYPES] = {
110 // UMA_RAPPOR_TYPE 131 // UMA_RAPPOR_TYPE
111 {128 /* Num cohorts */, 132 {128 /* Num cohorts */,
112 4 /* Bloom filter size bytes */, 133 4 /* Bloom filter size bytes */,
113 2 /* Bloom filter hash count */, 134 2 /* Bloom filter hash count */,
114 rappor::NORMAL_NOISE /* Noise level */, 135 rappor::NORMAL_NOISE /* Noise level */,
115 UMA_RAPPOR_GROUP /* Recording group */}, 136 UMA_RAPPOR_GROUP /* Recording group */},
116 // SAFEBROWSING_RAPPOR_TYPE 137 // SAFEBROWSING_RAPPOR_TYPE
117 {128 /* Num cohorts */, 138 {128 /* Num cohorts */,
118 1 /* Bloom filter size bytes */, 139 1 /* Bloom filter size bytes */,
119 2 /* Bloom filter hash count */, 140 2 /* Bloom filter hash count */,
120 rappor::NORMAL_NOISE /* Noise level */, 141 rappor::NORMAL_NOISE /* Noise level */,
121 SAFEBROWSING_RAPPOR_GROUP /* Recording group */}, 142 SAFEBROWSING_RAPPOR_GROUP /* Recording group */},
122 // ETLD_PLUS_ONE_RAPPOR_TYPE 143 // ETLD_PLUS_ONE_RAPPOR_TYPE
123 {128 /* Num cohorts */, 144 {128 /* Num cohorts */,
124 16 /* Bloom filter size bytes */, 145 16 /* Bloom filter size bytes */,
125 2 /* Bloom filter hash count */, 146 2 /* Bloom filter hash count */,
126 rappor::NORMAL_NOISE /* Noise level */, 147 rappor::NORMAL_NOISE /* Noise level */,
127 UMA_RAPPOR_GROUP /* Recording group */}, 148 UMA_RAPPOR_GROUP /* Recording group */},
149 // LOW_FREQUENCY_UMA_RAPPOR_TYPE
150 {128 /* Num cohorts */,
151 4 /* Bloom filter size bytes */,
152 2 /* Bloom filter hash count */,
153 rappor::SPARSE_NOISE /* Noise level */,
154 UMA_RAPPOR_GROUP /* Recording group */},
155 // LOW_FREQUENCY_SAFEBROWSING_RAPPOR_TYPE
156 {128 /* Num cohorts */,
157 1 /* Bloom filter size bytes */,
158 2 /* Bloom filter hash count */,
159 rappor::SPARSE_NOISE /* Noise level */,
160 SAFEBROWSING_RAPPOR_GROUP /* Recording group */},
161 // LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE
162 {128 /* Num cohorts */,
163 16 /* Bloom filter size bytes */,
164 2 /* Bloom filter hash count */,
165 rappor::SPARSE_NOISE /* Noise level */,
166 UMA_RAPPOR_GROUP /* Recording group */},
128 }; 167 };
129 168
130 } // namespace internal 169 } // namespace internal
131 170
132 } // namespace rappor 171 } // namespace rappor
133 172
134 #endif // COMPONENTS_RAPPOR_RAPPOR_PARAMETERS_H_ 173 #endif // COMPONENTS_RAPPOR_RAPPOR_PARAMETERS_H_
OLDNEW
« no previous file with comments | « chrome/browser/ssl/ssl_blocking_page.cc ('k') | components/security_interstitials/core/metrics_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698