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