Commit 4141ad05 authored by Caroline Rising's avatar Caroline Rising Committed by Chromium LUCI CQ

Read later: add metrics tracking read/unread counts on Desktop.

Track two sets of read/unread counts, one when the reading list model
has loaded and one when building a log for the current session using the
DesktopPlatformFeaturesMetricsProvider.

Bug: 1163938
Change-Id: I1b23847e7f209cc2a77b57f0e344d7c9b04c546b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2621914Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
Reviewed-by: default avatarJesse Doherty <jwd@chromium.org>
Commit-Queue: Caroline Rising <corising@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845158}
parent 10f20608
......@@ -4,7 +4,16 @@
#include "chrome/browser/metrics/desktop_platform_features_metrics_provider.h"
#include <vector>
#include "base/feature_list.h"
#include "base/metrics/histogram_macros.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/read_later/reading_list_model_factory.h"
#include "components/reading_list/core/reading_list_model.h"
#include "components/reading_list/features/reading_list_switches.h"
#include "ui/native_theme/native_theme.h"
namespace {
......@@ -34,4 +43,20 @@ void DesktopPlatformFeaturesMetricsProvider::ProvideCurrentSessionData(
: DarkModeStatus::kLight;
}
UMA_HISTOGRAM_ENUMERATION("Browser.DarkModeStatus", status);
// Record how many items are in the reading list.
if (base::FeatureList::IsEnabled(reading_list::switches::kReadLater)) {
std::vector<Profile*> profiles =
g_browser_process->profile_manager()->GetLoadedProfiles();
for (Profile* profile : profiles) {
ReadingListModel* model =
ReadingListModelFactory::GetForBrowserContext(profile);
if (model && model->loaded()) {
UMA_HISTOGRAM_COUNTS_1000("ReadingList.Unread.Count.OnUMAUpload",
model->unread_size());
UMA_HISTOGRAM_COUNTS_1000("ReadingList.Read.Count.OnUMAUpload",
model->size() - model->unread_size());
}
}
}
}
......@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/check_op.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/string_util.h"
#include "base/time/clock.h"
#include "components/prefs/pref_service.h"
......@@ -48,6 +49,12 @@ void ReadingListModelImpl::StoreLoaded(
}
DCHECK(read_entry_count_ + unread_entry_count_ == entries_->size());
loaded_ = true;
base::UmaHistogramCounts1000("ReadingList.Unread.Count.OnModelLoaded",
unread_entry_count_);
base::UmaHistogramCounts1000("ReadingList.Read.Count.OnModelLoaded",
read_entry_count_);
for (auto& observer : observers_)
observer.ReadingListModelLoaded(this);
}
......
......@@ -12581,6 +12581,24 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
</summary>
</histogram>
<histogram name="ReadingList.{ReadStatus}.Count.{Variation}" units="count"
expires_after="M92">
<owner>corising@chromium.org</owner>
<owner>chrome-desktop-ui-sea@google.com</owner>
<summary>
The number of {ReadStatus} items in the reading list. Recorded {Variation}.
</summary>
<token key="ReadStatus">
<variant name="Read" summary="read"/>
<variant name="Unread" summary="unread"/>
</token>
<token key="Variation">
<variant name="OnModelLoaded"
summary="when the reading list model is loaded"/>
<variant name="OnUMAUpload" summary="every UMA upload"/>
</token>
</histogram>
<histogram name="RecoveryComponent.Event" enum="RecoveryComponentEvent"
expires_after="M77">
<owner>robertshield@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