Commit 3fe60950 authored by Sky Malice's avatar Sky Malice Committed by Commit Bot

[Feed] Emit time since last fetch when fetch time is cleared.

Bug: 908963
Change-Id: I655419255ea7a99e3d053fba85464f0ce082ddfe
Reviewed-on: https://chromium-review.googlesource.com/c/1395137Reviewed-by: default avatarFilip Gorski <fgorski@chromium.org>
Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Commit-Queue: Sky Malice <skym@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619876}
parent 3add1473
...@@ -317,6 +317,14 @@ void FeedSchedulerHost::OnSuggestionsShown() { ...@@ -317,6 +317,14 @@ void FeedSchedulerHost::OnSuggestionsShown() {
} }
void FeedSchedulerHost::OnArticlesCleared(bool suppress_refreshes) { void FeedSchedulerHost::OnArticlesCleared(bool suppress_refreshes) {
base::TimeDelta attempt_age =
clock_->Now() - profile_prefs_->GetTime(prefs::kLastFetchAttemptTime);
UMA_HISTOGRAM_CUSTOM_TIMES(
"ContentSuggestions.Feed.Scheduler.TimeSinceLastFetchOnClear",
attempt_age, base::TimeDelta::FromSeconds(1),
base::TimeDelta::FromDays(7),
/*bucket_count=*/50);
// Since there are no stored articles, a refresh will be needed soon. // Since there are no stored articles, a refresh will be needed soon.
profile_prefs_->ClearPref(prefs::kLastFetchAttemptTime); profile_prefs_->ClearPref(prefs::kLastFetchAttemptTime);
......
...@@ -887,6 +887,16 @@ void RemoteSuggestionsSchedulerImpl::OnFetchCompleted(Status fetch_status) { ...@@ -887,6 +887,16 @@ void RemoteSuggestionsSchedulerImpl::OnFetchCompleted(Status fetch_status) {
} }
void RemoteSuggestionsSchedulerImpl::ClearLastFetchAttemptTime() { void RemoteSuggestionsSchedulerImpl::ClearLastFetchAttemptTime() {
// Added during Feed rollout to help investigate https://crbug.com/908963.
base::TimeDelta attempt_age =
clock_->Now() -
profile_prefs_->GetTime(prefs::kSnippetLastFetchAttemptTime);
UMA_HISTOGRAM_CUSTOM_TIMES(
"ContentSuggestions.Feed.Scheduler.TimeSinceLastFetchOnClear",
attempt_age, base::TimeDelta::FromSeconds(1),
base::TimeDelta::FromDays(7),
/*bucket_count=*/50);
profile_prefs_->ClearPref(prefs::kSnippetLastFetchAttemptTime); profile_prefs_->ClearPref(prefs::kSnippetLastFetchAttemptTime);
// To mark the last fetch as stale, we need to keep the time in prefs, only // To mark the last fetch as stale, we need to keep the time in prefs, only
// making sure it is long ago. // making sure it is long ago.
......
...@@ -16725,6 +16725,18 @@ uploading your change for review. ...@@ -16725,6 +16725,18 @@ uploading your change for review.
</summary> </summary>
</histogram> </histogram>
<histogram name="ContentSuggestions.Feed.Scheduler.TimeSinceLastFetchOnClear"
units="ms" expires_after="2019-10-01">
<owner>skym@chromium.org</owner>
<owner>fgorski@chromium.org</owner>
<summary>
When the previous last fetch attempt time is cleared, log the time since the
last fetch attempt. This typically occurs when suggestions are cleared. A
client that has never made a successful fetch (at least since it was last
cleared) will report the time since epoch.
</summary>
</histogram>
<histogram name="ContentSuggestions.Feed.TokenFetchStatus" <histogram name="ContentSuggestions.Feed.TokenFetchStatus"
enum="GoogleServiceAuthError"> enum="GoogleServiceAuthError">
<obsolete> <obsolete>
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