Commit aa74ca79 authored by Mark Pearson's avatar Mark Pearson Committed by Commit Bot

Add Metrics about Uploading UMA Records from Previous Sessions

Change-Id: I908a337129062e882b185a08329fecfd7db6c496
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2504593Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Commit-Queue: Mark Pearson <mpearson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822037}
parent 3793a1fb
......@@ -162,6 +162,7 @@ void UnsentLogStore::MarkStagedLogAsSent() {
DCHECK_LT(static_cast<size_t>(staged_log_index_), list_.size());
if (list_[staged_log_index_]->samples_count.has_value())
total_samples_sent_ += list_[staged_log_index_]->samples_count.value();
metrics_->RecordSentLog();
}
void UnsentLogStore::TrimAndPersistUnsentLogs() {
......@@ -303,6 +304,7 @@ void UnsentLogStore::TrimLogs() {
size_t dropped_logs_count = list_.size() - trimmed_list.size();
if (dropped_logs_count > 0)
metrics_->RecordDroppedLogsNum(dropped_logs_count);
metrics_->RecordIntendingToSentLogs(trimmed_list.size());
// Put the trimmed list in the correct place.
list_.swap(trimmed_list);
......
......@@ -22,6 +22,10 @@ void UnsentLogStoreMetrics::RecordDroppedLogSize(size_t size) {}
void UnsentLogStoreMetrics::RecordDroppedLogsNum(int dropped_logs_num) {}
void UnsentLogStoreMetrics::RecordIntendingToSentLogs(int num) {}
void UnsentLogStoreMetrics::RecordSentLog() {}
void UnsentLogStoreMetrics::RecordLastUnsentLogMetadataMetrics(
int unsent_samples_count,
int sent_samples_count,
......
......@@ -40,10 +40,21 @@ class UnsentLogStoreMetrics {
virtual void RecordCompressionRatio(size_t compressed_size,
size_t original_size);
// Records the size of a dropped log in bytes.
virtual void RecordDroppedLogSize(size_t size);
// Record the number of logs that were dropped (not staged). These include
// logs that were dropped due to be being too large and also logs that were
// dropped because there were too many.
virtual void RecordDroppedLogsNum(int dropped_logs_num);
// Records the number of logs that were not dropped and instead staged /
// intended to be sent.
virtual void RecordIntendingToSentLogs(int num);
// Record when a single staged log was sent.
virtual void RecordSentLog();
virtual void RecordLastUnsentLogMetadataMetrics(int unsent_samples_count,
int sent_samples_count,
int persisted_size_in_kb);
......
......@@ -31,6 +31,14 @@ void UnsentLogStoreMetricsImpl::RecordDroppedLogsNum(int dropped_logs_num) {
base::UmaHistogramCounts1M("UMA.UnsentLogs.Dropped", dropped_logs_num);
}
void RecordIntendingToSentLogs(int num) {
base::UmaHistogramExactLinear("UMA.UnsentLogs.IntendingToSend", num, 22);
}
void RecordSentLog() {
base::UmaHistogramBoolean("UMA.UnsentLogs.Sent", true);
}
void UnsentLogStoreMetricsImpl::RecordLastUnsentLogMetadataMetrics(
int unsent_samples_count,
int sent_samples_count,
......
......@@ -584,9 +584,13 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
expires_after="2021-08-30">
<owner>holte@chromium.org</owner>
<owner>asvitkine@chromium.org</owner>
<owner>mpearson@chromium.org</owner>
<owner>src/base/metrics/OWNERS</owner>
<summary>
Counter for number of UMA unsent logs removed from persistent storage.
The number of UMA unsent logs removed from persistent storage.
Useful in comparison with UMA.UnsentLogs.IntendingToSend (that counts hte
number of UMA unsent logs that are intended to be sent, i.e., not dropped).
</summary>
</histogram>
......@@ -604,6 +608,20 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
</summary>
</histogram>
<histogram name="UMA.UnsentLogs.IntendingToSend" units="logs"
expires_after="2021-04-01">
<owner>mpearson@chromium.org</owner>
<owner>src/base/metrics/OWNERS</owner>
<summary>
The number of UMA unsent logs from persistent storage that will be staged /
are intended to be sent. These logs are not dropped from persistent storage.
Useful in comparison with UMA.UnsentLogs.Dropped (to see how many persistent
logs are intended to be sent versus are not intended to be sent) and with
UMA.UnsentLogs.IntendingToSend (to see how many are actually sent).
</summary>
</histogram>
<histogram name="UMA.UnsentLogs.PersistedSizeInKB" units="KB"
expires_after="2021-05-30">
<owner>michaelbai@chromium.org</owner>
......@@ -616,6 +634,17 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
</summary>
</histogram>
<histogram name="UMA.UnsentLogs.Sent" enum="Boolean" expires_after="2021-04-01">
<owner>mpearson@chromium.org</owner>
<owner>src/base/metrics/OWNERS</owner>
<summary>
Emitted when a UMA unsent log is marked as sent.
Useful in comparison with UMA.UnsentLogs.Dropped and
UMA.UnsentLogs.IntendingToSend.
</summary>
</histogram>
<histogram name="UMA.UnsentLogs.SentCount" units="samples"
expires_after="2021-05-30">
<owner>michaelbai@chromium.org</owner>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment