xref: /aosp_15_r20/external/cronet/components/metrics/metrics_pref_names.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2014 The Chromium Authors
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 "components/metrics/metrics_pref_names.h"
6 
7 namespace metrics {
8 namespace prefs {
9 
10 // Set once, to the current epoch time, on the first run of chrome on this
11 // machine. Attached to metrics reports forever thereafter.
12 // Note: the 'uninstall_metrics' name is a legacy name and doesn't mean much.
13 const char kInstallDate[] = "uninstall_metrics.installation_date2";
14 
15 // A provisional metrics client GUID used for field trial group assignments
16 // before metrics reporting consent is known (i.e., during first run). This GUID
17 // is never reported directly. However, if the user enables UMA, this
18 // provisional client GUID becomes the metrics client GUID (see
19 // |kMetricsClientID|), and this pref is cleared. In that case, the GUID may
20 // be reported.
21 // Note: This GUID is stored in prefs because it is possible that the user
22 // closes Chrome during the FRE. We re-use this GUID in subsequent FRE runs
23 // until metrics reporting consent is truly known.
24 const char kMetricsProvisionalClientID[] =
25     "user_experience_metrics.provisional_client_id";
26 
27 // The metrics client GUID.
28 // Note: The name client_id2 is a result of creating
29 // new prefs to do a one-time reset of the previous values.
30 const char kMetricsClientID[] = "user_experience_metrics.client_id2";
31 
32 // An enum value indicating the default value of the enable metrics reporting
33 // checkbox shown during first-run. If it's opt-in, then the checkbox defaulted
34 // to unchecked, if it's opt-out, then it defaulted to checked. This value is
35 // only recorded during first-run, so older clients will not set it. The enum
36 // used for the value is metrics::MetricsServiceClient::EnableMetricsDefault.
37 const char kMetricsDefaultOptIn[] = "user_experience_metrics.default_opt_in";
38 
39 // Array of dictionaries that are each UMA logs that were supposed to be sent in
40 // the first minute of a browser session. These logs include things like crash
41 // count info, etc.
42 const char kMetricsInitialLogs[] = "user_experience_metrics.initial_logs2";
43 
44 // An dictionary of information about the unsent initial logs, it was
45 // recorded when the unsent log is persisted and will be written into the
46 // metrics at the next browser starts up.
47 const char kMetricsInitialLogsMetadata[] =
48     "user_experience_metrics.unsent_log_metadata.initial_logs";
49 
50 // A serialized representation of a base::UnguessableToken, used for randomizing
51 // limited entropy field trials.
52 const char kMetricsLimitedEntropyRandomizationSource[] =
53     "user_experience_metrics.limited_entropy_randomization_source";
54 
55 // A counter tracking the most recently used finalized log record id. Increment
56 // this value by one (1) for each finalized log.
57 const char kMetricsLogFinalizedRecordId[] =
58     "user_experience_metrics.log_finalized_record_id";
59 
60 // A counter tracking the most recently used log record id. Increment this value
61 // by one (1) for each newly created log.
62 const char kMetricsLogRecordId[] = "user_experience_metrics.log_record_id";
63 
64 // Low entropy source values. The new source (with suffix "3") was created
65 // because the old source (with suffix "2") is biased in the wild. Clients which
66 // have an old source still incorporate it into the high entropy source, to
67 // avoid reshuffling experiments using high entropy, but use the new source for
68 // experiments requiring low entropy. Newer clients only have the new source,
69 // and use it both for low entropy experiments to to incorporate into the high
70 // entropy source for high entropy experiments. The pseudo low entropy source
71 // is not used for trial assignment, but only for statistical validation. It
72 // should be assigned in the same way as the new source (with suffix "3").
73 const char kMetricsLowEntropySource[] =
74     "user_experience_metrics.low_entropy_source3";
75 const char kMetricsOldLowEntropySource[] =
76     "user_experience_metrics.low_entropy_source2";
77 const char kMetricsPseudoLowEntropySource[] =
78     "user_experience_metrics.pseudo_low_entropy_source";
79 
80 // A machine ID used to detect when underlying hardware changes. It is only
81 // stored locally and never transmitted in metrics reports.
82 const char kMetricsMachineId[] = "user_experience_metrics.machine_id";
83 
84 // Array of dictionaries that are each UMA logs that were not sent because the
85 // browser terminated before these accumulated metrics could be sent. These
86 // logs typically include histograms and memory reports, as well as ongoing
87 // user activities.
88 const char kMetricsOngoingLogs[] = "user_experience_metrics.ongoing_logs2";
89 
90 // An dictionary that is same as kUnsentLogMetkMetricsInitialLogsMetadata,
91 // but for the ongoing logs.
92 const char kMetricsOngoingLogsMetadata[] =
93     "user_experience_metrics.unsent_log_metadata.ongoing_logs";
94 
95 // Boolean that indicates a cloned install has been detected and the metrics
96 // client id and low entropy source should be reset.
97 const char kMetricsResetIds[] = "user_experience_metrics.reset_metrics_ids";
98 
99 #if BUILDFLAG(IS_ANDROID)
100 // Boolean that determines whether to use the new sampling trial
101 // "PostFREFixMetricsAndCrashSampling" and feature "PostFREFixMetricsReporting"
102 // to control sampling on Android Chrome. This is set to true when disabling
103 // metrics reporting, or on start up if metrics reporting is not consented to
104 // (including new users going through their first run). As a result, all new UMA
105 // users should have this pref set to true.
106 // Note: This exists due to a bug in which the old sampling rate was not being
107 // applied correctly. In order for the fix to not affect the overall sampling
108 // rate, this pref controls what trial/feature to use to determine whether the
109 // client is sampled. See crbug/1306481.
110 const char kUsePostFREFixSamplingTrial[] =
111     "user_experience_metrics.use_post_fre_fix_sampling_trial";
112 #endif  // BUILDFLAG(IS_ANDROID)
113 
114 // Boolean that specifies whether or not crash reporting and metrics reporting
115 // are sent over the network for analysis.
116 const char kMetricsReportingEnabled[] =
117     "user_experience_metrics.reporting_enabled";
118 
119 // Date/time when the user opted in to UMA and generated the client id most
120 // recently (local machine time, stored as a 64-bit time_t value).
121 const char kMetricsReportingEnabledTimestamp[] =
122     "user_experience_metrics.client_id_timestamp";
123 
124 // The metrics client session ID.
125 const char kMetricsSessionID[] = "user_experience_metrics.session_id";
126 
127 // The prefix of the last-seen timestamp for persistent histogram files.
128 // Values are named for the files themselves.
129 const char kMetricsLastSeenPrefix[] = "user_experience_metrics.last_seen.";
130 
131 // Array of the number of samples in the memory mapped file.
132 const char kMetricsFileMetricsMetadata[] =
133     "user_experience_metrics.file_metrics_metadata";
134 
135 // The number of times the client has been reset due to cloned install.
136 const char kClonedResetCount[] = "cloned_install.count";
137 
138 // The first timestamp when we reset a cloned client’s client id. This is only
139 // set once. Attached to metrics reports forever thereafter.
140 const char kFirstClonedResetTimestamp[] = "cloned_install.first_timestamp";
141 
142 // The last timestamp the client is reset due to cloned install. This will be
143 // updated every time we reset the client due to cloned install.
144 const char kLastClonedResetTimestamp[] = "cloned_install.last_timestamp";
145 
146 // A time stamp at which time the browser was known to be alive. Used to
147 // evaluate whether the browser crash was due to a whole system crash.
148 // At minimum this is updated each time the "exited_cleanly" preference is
149 // modified, but can also be optionally updated on a slow schedule.
150 const char kStabilityBrowserLastLiveTimeStamp[] =
151     "user_experience_metrics.stability.browser_last_live_timestamp";
152 
153 // Number of times the application exited uncleanly since the last report
154 // due to a gms core update.
155 const char kStabilityCrashCountDueToGmsCoreUpdate[] =
156     "user_experience_metrics.stability.crash_count_due_to_gms_core_update";
157 
158 // True if the previous run of the program exited cleanly.
159 const char kStabilityExitedCleanly[] =
160     "user_experience_metrics.stability.exited_cleanly";
161 
162 // The total number of samples that will be lost if ASSOCIATE_INTERNAL_PROFILE
163 // isn't enabled since the previous stability recorded, this is different than
164 // the previous browser run, because one file was just uploaded before the
165 // stability is recorded.
166 const char kStabilityFileMetricsUnsentSamplesCount[] =
167     "user_experience_metrics.stability.file_metrics_unsent_samples_count";
168 
169 // The number of the unsent files at the time the stability recorded.
170 const char kStabilityFileMetricsUnsentFilesCount[] =
171     "user_experience_metrics.stability.file_metrics_unsent_files_count";
172 
173 // The GMS core version used in Chrome.
174 const char kStabilityGmsCoreVersion[] =
175     "user_experience_metrics.stability.gms_core_version";
176 
177 #if BUILDFLAG(IS_ANDROID)
178 // Number of times the application was launched since last report. Used on
179 // Android platforms as WebView may still be interested in this metric.
180 const char kStabilityLaunchCount[] =
181     "user_experience_metrics.stability.launch_count";
182 
183 // Number of times a page load event occurred since the last report.
184 const char kStabilityPageLoadCount[] =
185     "user_experience_metrics.stability.page_load_count";
186 
187 // Number of times a renderer process successfully launched since the last
188 // report. Used on Android platforms as WebView may still be interested in this
189 // metric.
190 const char kStabilityRendererLaunchCount[] =
191     "user_experience_metrics.stability.renderer_launch_count";
192 #endif
193 
194 // Base64 encoded serialized UMA system profile proto from the previous session.
195 const char kStabilitySavedSystemProfile[] =
196     "user_experience_metrics.stability.saved_system_profile";
197 
198 // SHA-1 hash of the serialized UMA system profile proto (hex encoded).
199 const char kStabilitySavedSystemProfileHash[] =
200     "user_experience_metrics.stability.saved_system_profile_hash";
201 
202 // Build time, in seconds since an epoch, which is used to assure that stability
203 // metrics reported reflect stability of the same build.
204 const char kStabilityStatsBuildTime[] =
205     "user_experience_metrics.stability.stats_buildtime";
206 
207 // Version string of previous run, which is used to assure that stability
208 // metrics reported under current version reflect stability of the same version.
209 const char kStabilityStatsVersion[] =
210     "user_experience_metrics.stability.stats_version";
211 
212 // Number of times the application exited uncleanly and the system session
213 // embedding the browser session ended abnormally since the last report.
214 // Windows only.
215 const char kStabilitySystemCrashCount[] =
216     "user_experience_metrics.stability.system_crash_count";
217 
218 // Dictionary for measuring cellular data used by UKM service during last 7
219 // days.
220 const char kUkmCellDataUse[] = "user_experience_metrics.ukm_cell_datause";
221 
222 // Dictionary for measuring cellular data used by UMA service during last 7
223 // days.
224 const char kUmaCellDataUse[] = "user_experience_metrics.uma_cell_datause";
225 
226 // Dictionary for measuring cellular data used by user including chrome services
227 // per day.
228 const char kUserCellDataUse[] = "user_experience_metrics.user_call_datause";
229 
230 // String for holding user ID associated with the current ongoing UMA
231 // log. This pref will be used to determine whether to send metrics in case
232 // of a crash.
233 const char kMetricsCurrentUserId[] = "metrics.current_user_id";
234 
235 }  // namespace prefs
236 }  // namespace metrics
237