Commit 375d6d1d authored by falken's avatar falken Committed by Commit bot

ServiceWorker: Add UMA for Activate and Install event results.

We want to change activate so that rejecting the waitUntil promise
is the same as resolving it. Adding UMA to get an idea of the impact
of the change. It could be useful to have this data anyway, so also
adding it for Install.

BUG=480050

Review URL: https://codereview.chromium.org/1098953005

Cr-Commit-Position: refs/heads/master@{#326925}
parent 16a7cbdd
......@@ -95,4 +95,16 @@ void ServiceWorkerMetrics::RecordStartWorkerTime(const base::TimeDelta& time,
UMA_HISTOGRAM_MEDIUM_TIMES("ServiceWorker.StartNewWorker.Time", time);
}
void ServiceWorkerMetrics::RecordActivateEventStatus(
ServiceWorkerStatusCode status) {
UMA_HISTOGRAM_ENUMERATION("ServiceWorker.ActivateEventStatus", status,
SERVICE_WORKER_ERROR_MAX_VALUE);
}
void ServiceWorkerMetrics::RecordInstallEventStatus(
ServiceWorkerStatusCode status) {
UMA_HISTOGRAM_ENUMERATION("ServiceWorker.InstallEventStatus", status,
SERVICE_WORKER_ERROR_MAX_VALUE);
}
} // namespace content
......@@ -62,6 +62,9 @@ class ServiceWorkerMetrics {
static void RecordStartWorkerTime(const base::TimeDelta& time,
bool is_installed);
static void RecordActivateEventStatus(ServiceWorkerStatusCode status);
static void RecordInstallEventStatus(ServiceWorkerStatusCode status);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics);
};
......
......@@ -9,6 +9,7 @@
#include "base/message_loop/message_loop.h"
#include "content/browser/service_worker/service_worker_context_core.h"
#include "content/browser/service_worker/service_worker_job_coordinator.h"
#include "content/browser/service_worker/service_worker_metrics.h"
#include "content/browser/service_worker/service_worker_registration.h"
#include "content/browser/service_worker/service_worker_storage.h"
#include "content/browser/service_worker/service_worker_utils.h"
......@@ -385,6 +386,8 @@ void ServiceWorkerRegisterJob::InstallAndContinue() {
void ServiceWorkerRegisterJob::OnInstallFinished(
ServiceWorkerStatusCode status) {
ServiceWorkerMetrics::RecordInstallEventStatus(status);
if (status != SERVICE_WORKER_OK) {
// "8. If installFailed is true, then:..."
Complete(status);
......
......@@ -6,6 +6,7 @@
#include "content/browser/service_worker/service_worker_context_core.h"
#include "content/browser/service_worker/service_worker_info.h"
#include "content/browser/service_worker/service_worker_metrics.h"
#include "content/browser/service_worker/service_worker_register_job.h"
#include "content/browser/service_worker/service_worker_utils.h"
#include "content/public/browser/browser_thread.h"
......@@ -306,6 +307,8 @@ void ServiceWorkerRegistration::OnActivateEventFinished(
ServiceWorkerStatusCode status) {
if (!context_ || activating_version != active_version())
return;
ServiceWorkerMetrics::RecordActivateEventStatus(status);
// "If activateFailed is true, then:..."
if (status != SERVICE_WORKER_OK) {
// "Set registration's active worker to null." (The spec's step order may
......
......@@ -35053,7 +35053,16 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<histogram name="ServiceWorker.ActivateEventExecutionTime" units="millisecond">
<owner>shimazu@chromium.org</owner>
<summary>Execution time of ServiceWorkerGlobalScope.onactivate.</summary>
<summary>
Execution time of ServiceWorkerGlobalScope.onactivate. Includes the time for
waitUntil() promise to settle.
</summary>
</histogram>
<histogram name="ServiceWorker.ActivateEventStatus"
enum="ServiceWorkerStatusCode">
<owner>falken@chromium.org</owner>
<summary>The result of dispatching the activate event to the worker.</summary>
</histogram>
<histogram name="ServiceWorker.Database.DestroyDatabaseResult"
......@@ -35111,12 +35120,24 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<histogram name="ServiceWorker.FetchEventExecutionTime" units="millisecond">
<owner>shimazu@chromium.org</owner>
<summary>Execution time of ServiceWorkerGlobalScope.onfetch.</summary>
<summary>
Execution time of ServiceWorkerGlobalScope.onfetch. Includes the time for
the respondWith() promise to settle.
</summary>
</histogram>
<histogram name="ServiceWorker.InstallEventExecutionTime" units="millisecond">
<owner>shimazu@chromium.org</owner>
<summary>Execution time of ServiceWorkerGlobalScope.oninstall.</summary>
<summary>
Execution time of ServiceWorkerGlobalScope.oninstall. Includes the time for
the waitUntil() promise to settle.
</summary>
</histogram>
<histogram name="ServiceWorker.InstallEventStatus"
enum="ServiceWorkerStatusCode">
<owner>falken@chromium.org</owner>
<summary>The result of dispatching the install event to the worker.</summary>
</histogram>
<histogram name="ServiceWorker.MessageEventExecutionTime" units="millisecond">
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