Save the unsent log info for metrics
- Add the optional dedicated preference for the unsent log info.
- Save the unsent log info at each time the unsent log persisted.
- Read the unsent log info at next browser startup.
- Define the record method in UnsentLogStoreMetrics to record
the count of the unsent samples, the count of the sent samples
the percentage of unsent samples and the persisted logs size.
Bug: 1076564
Change-Id: I1ba3018ae819ff6f350fbf6a1fe8d7dbf0d17e26
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2224314
Commit-Queue: Tao Bai <[email protected]>
Reviewed-by: Alexei Svitkine <[email protected]>
Cr-Commit-Position: refs/heads/master@{#775841}
diff --git a/components/metrics/metrics_pref_names.cc b/components/metrics/metrics_pref_names.cc
index 63250e1..38dffd3 100644
--- a/components/metrics/metrics_pref_names.cc
+++ b/components/metrics/metrics_pref_names.cc
@@ -28,6 +28,12 @@
// count info, etc.
const char kMetricsInitialLogs[] = "user_experience_metrics.initial_logs2";
+// An dictionary of information about the unsent initial logs, it was
+// recorded when the unsent log is persisted and will be written into the
+// metrics at the next browser starts up.
+const char kMetricsInitialLogsMetadata[] =
+ "user_experience_metrics.unsent_log_metadata.initial_logs";
+
// Low entropy source values. The new source (with suffix "3") was created
// because the old source (with suffix "2") is biased in the wild. Clients which
// have an old source still incorporate it into the high entropy source, to
@@ -50,6 +56,11 @@
// user activities.
const char kMetricsOngoingLogs[] = "user_experience_metrics.ongoing_logs2";
+// An dictionary that is same as kUnsentLogMetkMetricsInitialLogsMetadata,
+// but for the ongoing logs.
+const char kMetricsOngoingLogsMetadata[] =
+ "user_experience_metrics.unsent_log_metadata.ongoing_logs";
+
// Boolean that indicates a cloned install has been detected and the metrics
// client id and low entropy source should be reset.
const char kMetricsResetIds[] = "user_experience_metrics.reset_metrics_ids";