Commit 3bd1fc34 authored by Kenichi Ishibashi's avatar Kenichi Ishibashi Committed by Commit Bot

service worker: Add UMA for retry count for storage service recovery

Bug: 1133143
Change-Id: I3f0f082402506138ce00e9228e58549fe8ca7db6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2532161
Commit-Queue: Mark Pearson <mpearson@chromium.org>
Auto-Submit: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: default avatarMark Pearson <mpearson@chromium.org>
Reviewed-by: default avatarMakoto Shimazu <shimazu@chromium.org>
Reviewed-by: default avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827082}
parent bcb91608
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/stl_util.h" #include "base/stl_util.h"
#include "base/task/post_task.h" #include "base/task/post_task.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
...@@ -85,6 +86,11 @@ void CompleteFindSoon( ...@@ -85,6 +86,11 @@ void CompleteFindSoon(
status, std::move(callback))); status, std::move(callback)));
} }
void RecordRetryCount(size_t retries) {
base::UmaHistogramCounts100("ServiceWorker.Storage.RetryCountForRecovery",
retries);
}
} // namespace } // namespace
// A helper class that runs on the IO thread to observe storage policy updates. // A helper class that runs on the IO thread to observe storage policy updates.
...@@ -1353,6 +1359,7 @@ void ServiceWorkerRegistry::OnRemoteStorageDisconnected() { ...@@ -1353,6 +1359,7 @@ void ServiceWorkerRegistry::OnRemoteStorageDisconnected() {
if (connection_state_ == ConnectionState::kRecovering) { if (connection_state_ == ConnectionState::kRecovering) {
++recovery_retry_counts_; ++recovery_retry_counts_;
if (recovery_retry_counts_ > kMaxRetryCounts) { if (recovery_retry_counts_ > kMaxRetryCounts) {
RecordRetryCount(kMaxRetryCounts);
CHECK(false) << "The Storage Service consistently crashes."; CHECK(false) << "The Storage Service consistently crashes.";
return; return;
} }
...@@ -1375,6 +1382,8 @@ void ServiceWorkerRegistry::OnRemoteStorageDisconnected() { ...@@ -1375,6 +1382,8 @@ void ServiceWorkerRegistry::OnRemoteStorageDisconnected() {
void ServiceWorkerRegistry::DidRecover() { void ServiceWorkerRegistry::DidRecover() {
DCHECK_CURRENTLY_ON(ServiceWorkerContext::GetCoreThreadId()); DCHECK_CURRENTLY_ON(ServiceWorkerContext::GetCoreThreadId());
RecordRetryCount(recovery_retry_counts_);
recovery_retry_counts_ = 0; recovery_retry_counts_ = 0;
connection_state_ = ConnectionState::kNormal; connection_state_ = ConnectionState::kNormal;
// TODO(crbug.com/1133143): Retry mojo method calls which are invoked during // TODO(crbug.com/1133143): Retry mojo method calls which are invoked during
......
...@@ -1094,6 +1094,18 @@ reviews. Googlers can read more about this at go/gwsq-gerrit. ...@@ -1094,6 +1094,18 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
</summary> </summary>
</histogram> </histogram>
<histogram name="ServiceWorker.Storage.RetryCountForRecovery" units="retries"
expires_after="2021-06-30">
<owner>bashi@chromium.org</owner>
<owner>chrome-worker@google.com</owner>
<summary>
The counts of retries to recover after a Storage Service crash. Logged after
a recovery, or the maximum number of retries is exceeded See
ServiceWorkerRegistry::OnRemoteStorageDisconnected() for the maximum number
of retries.
</summary>
</histogram>
<histogram name="ServiceWorker.WorkerForMessageFound" enum="Boolean" <histogram name="ServiceWorker.WorkerForMessageFound" enum="Boolean"
expires_after="M85"> expires_after="M85">
<owner>falken@chromium.org</owner> <owner>falken@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