• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 counter tracking the most recently used log record id. Increment this value
51 // by one (1) for each newly created log.
52 const char kMetricsLogRecordId[] = "user_experience_metrics.log_record_id";
53 
54 // Low entropy source values. The new source (with suffix "3") was created
55 // because the old source (with suffix "2") is biased in the wild. Clients which
56 // have an old source still incorporate it into the high entropy source, to
57 // avoid reshuffling experiments using high entropy, but use the new source for
58 // experiments requiring low entropy. Newer clients only have the new source,
59 // and use it both for low entropy experiments to to incorporate into the high
60 // entropy source for high entropy experiments. The pseudo low entropy source
61 // is not used for trial assignment, but only for statistical validation. It
62 // should be assigned in the same way as the new source (with suffix "3").
63 const char kMetricsLowEntropySource[] =
64     "user_experience_metrics.low_entropy_source3";
65 const char kMetricsOldLowEntropySource[] =
66     "user_experience_metrics.low_entropy_source2";
67 const char kMetricsPseudoLowEntropySource[] =
68     "user_experience_metrics.pseudo_low_entropy_source";
69 
70 // A machine ID used to detect when underlying hardware changes. It is only
71 // stored locally and never transmitted in metrics reports.
72 const char kMetricsMachineId[] = "user_experience_metrics.machine_id";
73 
74 // Array of dictionaries that are each UMA logs that were not sent because the
75 // browser terminated before these accumulated metrics could be sent. These
76 // logs typically include histograms and memory reports, as well as ongoing
77 // user activities.
78 const char kMetricsOngoingLogs[] = "user_experience_metrics.ongoing_logs2";
79 
80 // An dictionary that is same as kUnsentLogMetkMetricsInitialLogsMetadata,
81 // but for the ongoing logs.
82 const char kMetricsOngoingLogsMetadata[] =
83     "user_experience_metrics.unsent_log_metadata.ongoing_logs";
84 
85 // Boolean that indicates a cloned install has been detected and the metrics
86 // client id and low entropy source should be reset.
87 const char kMetricsResetIds[] = "user_experience_metrics.reset_metrics_ids";
88 
89 #if BUILDFLAG(IS_ANDROID)
90 // Boolean that determines whether to use the new sampling trial
91 // "PostFREFixMetricsAndCrashSampling" and feature "PostFREFixMetricsReporting"
92 // to control sampling on Android Chrome. This is set to true when disabling
93 // metrics reporting, or on start up if metrics reporting is not consented to
94 // (including new users going through their first run). As a result, all new UMA
95 // users should have this pref set to true.
96 // Note: This exists due to a bug in which the old sampling rate was not being
97 // applied correctly. In order for the fix to not affect the overall sampling
98 // rate, this pref controls what trial/feature to use to determine whether the
99 // client is sampled. See crbug/1306481.
100 const char kUsePostFREFixSamplingTrial[] =
101     "user_experience_metrics.use_post_fre_fix_sampling_trial";
102 #endif  // BUILDFLAG(IS_ANDROID)
103 
104 // Boolean that specifies whether or not crash reporting and metrics reporting
105 // are sent over the network for analysis.
106 const char kMetricsReportingEnabled[] =
107     "user_experience_metrics.reporting_enabled";
108 
109 // Date/time when the user opted in to UMA and generated the client id most
110 // recently (local machine time, stored as a 64-bit time_t value).
111 const char kMetricsReportingEnabledTimestamp[] =
112     "user_experience_metrics.client_id_timestamp";
113 
114 // The metrics client session ID.
115 const char kMetricsSessionID[] = "user_experience_metrics.session_id";
116 
117 // The prefix of the last-seen timestamp for persistent histogram files.
118 // Values are named for the files themselves.
119 const char kMetricsLastSeenPrefix[] = "user_experience_metrics.last_seen.";
120 
121 // Array of the number of samples in the memory mapped file.
122 const char kMetricsFileMetricsMetadata[] =
123     "user_experience_metrics.file_metrics_metadata";
124 
125 // The number of times the client has been reset due to cloned install.
126 const char kClonedResetCount[] = "cloned_install.count";
127 
128 // The first timestamp when we reset a cloned client’s client id. This is only
129 // set once. Attached to metrics reports forever thereafter.
130 const char kFirstClonedResetTimestamp[] = "cloned_install.first_timestamp";
131 
132 // The last timestamp the client is reset due to cloned install. This will be
133 // updated every time we reset the client due to cloned install.
134 const char kLastClonedResetTimestamp[] = "cloned_install.last_timestamp";
135 
136 // A time stamp at which time the browser was known to be alive. Used to
137 // evaluate whether the browser crash was due to a whole system crash.
138 // At minimum this is updated each time the "exited_cleanly" preference is
139 // modified, but can also be optionally updated on a slow schedule.
140 const char kStabilityBrowserLastLiveTimeStamp[] =
141     "user_experience_metrics.stability.browser_last_live_timestamp";
142 
143 // Number of times the application exited uncleanly since the last report
144 // due to a gms core update.
145 const char kStabilityCrashCountDueToGmsCoreUpdate[] =
146     "user_experience_metrics.stability.crash_count_due_to_gms_core_update";
147 
148 // True if the previous run of the program exited cleanly.
149 const char kStabilityExitedCleanly[] =
150     "user_experience_metrics.stability.exited_cleanly";
151 
152 // The total number of samples that will be lost if ASSOCIATE_INTERNAL_PROFILE
153 // isn't enabled since the previous stability recorded, this is different than
154 // the previous browser run, because one file was just uploaded before the
155 // stability is recorded.
156 const char kStabilityFileMetricsUnsentSamplesCount[] =
157     "user_experience_metrics.stability.file_metrics_unsent_samples_count";
158 
159 // The number of the unsent files at the time the stability recorded.
160 const char kStabilityFileMetricsUnsentFilesCount[] =
161     "user_experience_metrics.stability.file_metrics_unsent_files_count";
162 
163 // The GMS core version used in Chrome.
164 const char kStabilityGmsCoreVersion[] =
165     "user_experience_metrics.stability.gms_core_version";
166 
167 #if BUILDFLAG(IS_ANDROID)
168 // Number of times the application was launched since last report. Used on
169 // Android platforms as WebView may still be interested in this metric.
170 const char kStabilityLaunchCount[] =
171     "user_experience_metrics.stability.launch_count";
172 
173 // Number of times a page load event occurred since the last report.
174 const char kStabilityPageLoadCount[] =
175     "user_experience_metrics.stability.page_load_count";
176 
177 // Number of times a renderer process successfully launched since the last
178 // report. Used on Android platforms as WebView may still be interested in this
179 // metric.
180 const char kStabilityRendererLaunchCount[] =
181     "user_experience_metrics.stability.renderer_launch_count";
182 #endif
183 
184 // Base64 encoded serialized UMA system profile proto from the previous session.
185 const char kStabilitySavedSystemProfile[] =
186     "user_experience_metrics.stability.saved_system_profile";
187 
188 // SHA-1 hash of the serialized UMA system profile proto (hex encoded).
189 const char kStabilitySavedSystemProfileHash[] =
190     "user_experience_metrics.stability.saved_system_profile_hash";
191 
192 // Build time, in seconds since an epoch, which is used to assure that stability
193 // metrics reported reflect stability of the same build.
194 const char kStabilityStatsBuildTime[] =
195     "user_experience_metrics.stability.stats_buildtime";
196 
197 // Version string of previous run, which is used to assure that stability
198 // metrics reported under current version reflect stability of the same version.
199 const char kStabilityStatsVersion[] =
200     "user_experience_metrics.stability.stats_version";
201 
202 // Number of times the application exited uncleanly and the system session
203 // embedding the browser session ended abnormally since the last report.
204 // Windows only.
205 const char kStabilitySystemCrashCount[] =
206     "user_experience_metrics.stability.system_crash_count";
207 
208 // Dictionary for measuring cellular data used by UKM service during last 7
209 // days.
210 const char kUkmCellDataUse[] = "user_experience_metrics.ukm_cell_datause";
211 
212 // Dictionary for measuring cellular data used by UMA service during last 7
213 // days.
214 const char kUmaCellDataUse[] = "user_experience_metrics.uma_cell_datause";
215 
216 // Dictionary for measuring cellular data used by user including chrome services
217 // per day.
218 const char kUserCellDataUse[] = "user_experience_metrics.user_call_datause";
219 
220 // String for holding user ID associated with the current ongoing UMA
221 // log. This pref will be used to determine whether to send metrics in case
222 // of a crash.
223 const char kMetricsCurrentUserId[] = "metrics.current_user_id";
224 
225 }  // namespace prefs
226 }  // namespace metrics
227