Bug 1115820 - Add telemetry to ServiceWorkers. r=nsm, r=vladan

--HG--
extra : rebase_source : 69547573525bcea989d24e0a0293f6df9e7f90e1
This commit is contained in:
Jose Antonio Olivera Ortega 2015-06-05 08:11:18 +02:00
Родитель 8e0eed7a2a
Коммит 88a9211951
3 изменённых файлов: 41 добавлений и 5 удалений

Просмотреть файл

@ -1667,6 +1667,12 @@ RuntimeService::UnregisterWorker(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
}
}
if (aWorkerPrivate->IsServiceWorker()) {
AssertIsOnMainThread();
Telemetry::AccumulateTimeDelta(Telemetry::SERVICE_WORKER_LIFE_TIME,
aWorkerPrivate->CreationTimeStamp());
}
if (aWorkerPrivate->IsSharedWorker()) {
AssertIsOnMainThread();

Просмотреть файл

@ -28,6 +28,7 @@
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/ErrorNames.h"
#include "mozilla/LoadContext.h"
#include "mozilla/Telemetry.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/DOMError.h"
@ -814,6 +815,9 @@ public:
return;
}
AssertIsOnMainThread();
Telemetry::Accumulate(Telemetry::SERVICE_WORKER_UPDATED, 1);
nsRefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
nsCOMPtr<nsIURI> scriptURI;
@ -1322,6 +1326,9 @@ ServiceWorkerManager::Register(nsIDOMWindow* aWindow,
new ServiceWorkerRegisterJob(queue, cleanedScope, spec, cb, documentPrincipal);
queue->Append(job);
AssertIsOnMainThread();
Telemetry::Accumulate(Telemetry::SERVICE_WORKER_REGISTRATIONS, 1);
promise.forget(aPromise);
return NS_OK;
}
@ -2790,6 +2797,7 @@ ServiceWorkerManager::StartControllingADocument(ServiceWorkerRegistrationInfo* a
aRegistration->StartControllingADocument();
mControlledDocuments.Put(aDoc, aRegistration);
Telemetry::Accumulate(Telemetry::SERVICE_WORKER_CONTROLLED_DOCUMENTS, 1);
}
void

Просмотреть файл

@ -7493,12 +7493,12 @@
"kind": "exponential",
"high": "5000",
"n_buckets": 20,
"description": "Tracking how ServiceWorkerRegistrar loads data before the first content is shown"
"description": "Tracking how ServiceWorkerRegistrar loads data before the first content is shown. File bugs in Core::DOM in case of a Telemetry regression."
},
"SERVICE_WORKER_REQUEST_PASSTHROUGH": {
"expires_in_version": "50",
"kind": "boolean",
"description": "Intercepted fetch sending back same Request object."
"description": "Intercepted fetch sending back same Request object. File bugs in Core::DOM in case of a Telemetry regression."
},
"LOOP_CLIENT_CALL_URL_REQUESTS_SUCCESS": {
"expires_in_version": "never",
@ -8007,17 +8007,39 @@
"SERVICE_WORKER_SPAWN_ATTEMPTS": {
"expires_in_version": "50",
"kind": "count",
"description": "Count attempts to spawn a ServiceWorker for a domain"
"description": "Count attempts to spawn a ServiceWorker for a domain. File bugs in Core::DOM in case of a Telemetry regression."
},
"SERVICE_WORKER_WAS_SPAWNED": {
"expires_in_version": "50",
"kind": "count",
"description": "Count ServiceWorkers that really did get a thread created for them"
"description": "Count ServiceWorkers that really did get a thread created for them. File bugs in Core::DOM in case of a Telemetry regression."
},
"SERVICE_WORKER_SPAWN_GETS_QUEUED": {
"expires_in_version": "50",
"kind": "count",
"description": "Tracking whether a ServiceWorker spawn gets queued due to hitting max workers per domain limit"
"description": "Tracking whether a ServiceWorker spawn gets queued due to hitting max workers per domain limit. File bugs in Core::DOM in case of a Telemetry regression."
},
"SERVICE_WORKER_REGISTRATIONS": {
"expires_in_version": "50",
"kind": "count",
"description": "Count how many registrations occurs. File bugs in Core::DOM in case of a Telemetry regression."
},
"SERVICE_WORKER_CONTROLLED_DOCUMENTS": {
"expires_in_version": "50",
"kind": "count",
"description": "Count whenever a document is controlled. File bugs in Core::DOM in case of a Telemetry regression."
},
"SERVICE_WORKER_UPDATED": {
"expires_in_version": "50",
"kind": "count",
"description": "Count ServiceWorkers scripts that are updated. File bugs in Core::DOM in case of a Telemetry regression."
},
"SERVICE_WORKER_LIFE_TIME": {
"expires_in_version": "50",
"kind": "exponential",
"high": "120000",
"n_buckets": 20,
"description": "Tracking how long a ServiceWorker stays alive after it is spawned. File bugs in Core::DOM in case of a Telemetry regression."
},
"GRAPHICS_SANITY_TEST": {
"expires_in_version": "never",