mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1915228
- Remove expired telemetry scalars serviceworker.registrations and serviceworker.running_max, r=chutten,jesup.
Depends on D220323 Differential Revision: https://phabricator.services.mozilla.com/D220324
This commit is contained in:
parent
310eba3ff8
commit
f657343551
@ -109,11 +109,6 @@ using namespace mozilla::ipc;
|
||||
|
||||
namespace mozilla::dom {
|
||||
|
||||
// Counts the number of registered ServiceWorkers, and the number that
|
||||
// handle Fetch, for reporting in Telemetry
|
||||
uint32_t gServiceWorkersRegistered = 0;
|
||||
uint32_t gServiceWorkersRegisteredFetch = 0;
|
||||
|
||||
static_assert(
|
||||
nsIHttpChannelInternal::REDIRECT_MODE_FOLLOW ==
|
||||
static_cast<uint32_t>(RequestRedirect::Follow),
|
||||
@ -1581,21 +1576,9 @@ void ServiceWorkerManager::LoadRegistration(
|
||||
void ServiceWorkerManager::LoadRegistrations(
|
||||
const nsTArray<ServiceWorkerRegistrationData>& aRegistrations) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
uint32_t fetch = 0;
|
||||
for (uint32_t i = 0, len = aRegistrations.Length(); i < len; ++i) {
|
||||
LoadRegistration(aRegistrations[i]);
|
||||
if (aRegistrations[i].currentWorkerHandlesFetch()) {
|
||||
fetch++;
|
||||
}
|
||||
}
|
||||
gServiceWorkersRegistered = aRegistrations.Length();
|
||||
gServiceWorkersRegisteredFetch = fetch;
|
||||
Telemetry::ScalarSet(Telemetry::ScalarID::SERVICEWORKER_REGISTRATIONS,
|
||||
u"All"_ns, gServiceWorkersRegistered);
|
||||
Telemetry::ScalarSet(Telemetry::ScalarID::SERVICEWORKER_REGISTRATIONS,
|
||||
u"Fetch"_ns, gServiceWorkersRegisteredFetch);
|
||||
LOG(("LoadRegistrations: %u, fetch %u\n", gServiceWorkersRegistered,
|
||||
gServiceWorkersRegisteredFetch));
|
||||
}
|
||||
|
||||
void ServiceWorkerManager::StoreRegistration(
|
||||
|
@ -44,9 +44,6 @@ class PrincipalInfo;
|
||||
|
||||
namespace dom {
|
||||
|
||||
extern uint32_t gServiceWorkersRegistered;
|
||||
extern uint32_t gServiceWorkersRegisteredFetch;
|
||||
|
||||
class ContentParent;
|
||||
class ServiceWorkerInfo;
|
||||
class ServiceWorkerJobQueue;
|
||||
|
@ -1505,16 +1505,12 @@ void ServiceWorkerPrivate::UpdateRunning(int32_t aDelta, int32_t aFetchDelta) {
|
||||
if (sRunningServiceWorkers > sRunningServiceWorkersMax) {
|
||||
sRunningServiceWorkersMax = sRunningServiceWorkers;
|
||||
LOG(("ServiceWorker max now %d", sRunningServiceWorkersMax));
|
||||
Telemetry::ScalarSet(Telemetry::ScalarID::SERVICEWORKER_RUNNING_MAX,
|
||||
u"All"_ns, sRunningServiceWorkersMax);
|
||||
}
|
||||
MOZ_ASSERT(((int64_t)sRunningServiceWorkersFetch) + aFetchDelta >= 0);
|
||||
sRunningServiceWorkersFetch += aFetchDelta;
|
||||
if (sRunningServiceWorkersFetch > sRunningServiceWorkersFetchMax) {
|
||||
sRunningServiceWorkersFetchMax = sRunningServiceWorkersFetch;
|
||||
LOG(("ServiceWorker Fetch max now %d", sRunningServiceWorkersFetchMax));
|
||||
Telemetry::ScalarSet(Telemetry::ScalarID::SERVICEWORKER_RUNNING_MAX,
|
||||
u"Fetch"_ns, sRunningServiceWorkersFetchMax);
|
||||
}
|
||||
LOG(("ServiceWorkers running now %d/%d", sRunningServiceWorkers,
|
||||
sRunningServiceWorkersFetch));
|
||||
|
@ -5,7 +5,6 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "ServiceWorkerRegistrar.h"
|
||||
#include "ServiceWorkerManager.h"
|
||||
#include "mozilla/dom/ServiceWorkerRegistrarTypes.h"
|
||||
#include "mozilla/dom/DOMException.h"
|
||||
#include "mozilla/StaticPrefs_dom.h"
|
||||
@ -46,13 +45,6 @@
|
||||
|
||||
using namespace mozilla::ipc;
|
||||
|
||||
extern mozilla::LazyLogModule sWorkerTelemetryLog;
|
||||
|
||||
#ifdef LOG
|
||||
# undef LOG
|
||||
#endif
|
||||
#define LOG(_args) MOZ_LOG(sWorkerTelemetryLog, LogLevel::Debug, _args);
|
||||
|
||||
namespace mozilla::dom {
|
||||
|
||||
namespace {
|
||||
@ -298,18 +290,6 @@ void ServiceWorkerRegistrar::UnregisterServiceWorker(
|
||||
|
||||
for (uint32_t i = 0; i < mData.Length(); ++i) {
|
||||
if (Equivalent(tmp, mData[i])) {
|
||||
gServiceWorkersRegistered--;
|
||||
if (mData[i].currentWorkerHandlesFetch()) {
|
||||
gServiceWorkersRegisteredFetch--;
|
||||
}
|
||||
// Update Telemetry
|
||||
Telemetry::ScalarSet(Telemetry::ScalarID::SERVICEWORKER_REGISTRATIONS,
|
||||
u"All"_ns, gServiceWorkersRegistered);
|
||||
Telemetry::ScalarSet(Telemetry::ScalarID::SERVICEWORKER_REGISTRATIONS,
|
||||
u"Fetch"_ns, gServiceWorkersRegisteredFetch);
|
||||
LOG(("Unregister ServiceWorker: %u, fetch %u\n",
|
||||
gServiceWorkersRegistered, gServiceWorkersRegisteredFetch));
|
||||
|
||||
mData.RemoveElementAt(i);
|
||||
mDataGeneration = GetNextGeneration();
|
||||
deleted = true;
|
||||
@ -940,12 +920,6 @@ void ServiceWorkerRegistrar::RegisterServiceWorkerInternal(
|
||||
for (uint32_t i = 0, len = mData.Length(); i < len; ++i) {
|
||||
if (Equivalent(aData, mData[i])) {
|
||||
found = true;
|
||||
if (mData[i].currentWorkerHandlesFetch()) {
|
||||
// Decrement here if we found it, in case the new registration no
|
||||
// longer handles Fetch. If it continues to handle fetch, we'll
|
||||
// bump it back later.
|
||||
gServiceWorkersRegisteredFetch--;
|
||||
}
|
||||
mData[i] = aData;
|
||||
break;
|
||||
}
|
||||
@ -954,20 +928,7 @@ void ServiceWorkerRegistrar::RegisterServiceWorkerInternal(
|
||||
if (!found) {
|
||||
MOZ_ASSERT(ServiceWorkerRegistrationDataIsValid(aData));
|
||||
mData.AppendElement(aData);
|
||||
// We didn't find an entry to update, so we have 1 more
|
||||
gServiceWorkersRegistered++;
|
||||
}
|
||||
// Handles bumping both for new registrations and updates
|
||||
if (aData.currentWorkerHandlesFetch()) {
|
||||
gServiceWorkersRegisteredFetch++;
|
||||
}
|
||||
// Update Telemetry
|
||||
Telemetry::ScalarSet(Telemetry::ScalarID::SERVICEWORKER_REGISTRATIONS,
|
||||
u"All"_ns, gServiceWorkersRegistered);
|
||||
Telemetry::ScalarSet(Telemetry::ScalarID::SERVICEWORKER_REGISTRATIONS,
|
||||
u"Fetch"_ns, gServiceWorkersRegisteredFetch);
|
||||
LOG(("Register: %u, fetch %u\n", gServiceWorkersRegistered,
|
||||
gServiceWorkersRegisteredFetch));
|
||||
|
||||
mDataGeneration = GetNextGeneration();
|
||||
}
|
||||
|
@ -314,12 +314,6 @@ function getSWTelemetrySums() {
|
||||
SERVICE_WORKER_RUNNING_Fetch: keyedhistograms.SERVICE_WORKER_RUNNING
|
||||
? keyedhistograms.SERVICE_WORKER_RUNNING.Fetch.sum
|
||||
: 0,
|
||||
SERVICEWORKER_RUNNING_MAX_All: keyedscalars["serviceworker.running_max"]
|
||||
? keyedscalars["serviceworker.running_max"].All
|
||||
: 0,
|
||||
SERVICEWORKER_RUNNING_MAX_Fetch: keyedscalars["serviceworker.running_max"]
|
||||
? keyedscalars["serviceworker.running_max"].Fetch
|
||||
: 0,
|
||||
};
|
||||
}
|
||||
|
||||
@ -371,24 +365,12 @@ add_task(async function test() {
|
||||
", Fetch: " +
|
||||
initialSums.SERVICE_WORKER_RUNNING_Fetch
|
||||
);
|
||||
info(
|
||||
"Initial Max Running All: " +
|
||||
initialSums.SERVICEWORKER_RUNNING_MAX_All +
|
||||
", Fetch: " +
|
||||
initialSums.SERVICEWORKER_RUNNING_MAX_Fetch
|
||||
);
|
||||
info(
|
||||
"Running All: " +
|
||||
telemetrySums.SERVICE_WORKER_RUNNING_All +
|
||||
", Fetch: " +
|
||||
telemetrySums.SERVICE_WORKER_RUNNING_Fetch
|
||||
);
|
||||
info(
|
||||
"Max Running All: " +
|
||||
telemetrySums.SERVICEWORKER_RUNNING_MAX_All +
|
||||
", Fetch: " +
|
||||
telemetrySums.SERVICEWORKER_RUNNING_MAX_Fetch
|
||||
);
|
||||
Assert.greater(
|
||||
telemetrySums.SERVICE_WORKER_RUNNING_All,
|
||||
initialSums.SERVICE_WORKER_RUNNING_All,
|
||||
@ -399,7 +381,4 @@ add_task(async function test() {
|
||||
initialSums.SERVICE_WORKER_RUNNING_Fetch,
|
||||
"ServiceWorker running count changed"
|
||||
);
|
||||
// We don't use ok()'s for MAX because MAX may have been set before we
|
||||
// set canRecordExtended, and if so we won't record a new value unless
|
||||
// the max increases again.
|
||||
});
|
||||
|
@ -4783,52 +4783,6 @@ browser.timings:
|
||||
record_in_processes:
|
||||
- 'main'
|
||||
|
||||
# The following section contains the service worker scalars.
|
||||
serviceworker:
|
||||
registrations:
|
||||
description: >
|
||||
Count how many registrations occur. File bugs in Core::DOM in case of a Telemetry regression.
|
||||
|
||||
record_in_processes:
|
||||
- 'main'
|
||||
products:
|
||||
- 'firefox'
|
||||
- 'fennec'
|
||||
expires: "102"
|
||||
kind: uint
|
||||
bug_numbers:
|
||||
- 1740335
|
||||
notification_emails:
|
||||
- sw-telemetry@mozilla.com
|
||||
- rjesup@mozilla.com
|
||||
- echuang@mozilla.com
|
||||
keyed: true
|
||||
keys:
|
||||
- All
|
||||
- Fetch
|
||||
|
||||
running_max:
|
||||
description: >
|
||||
The maximum number of simultaneous running ServiceWorkers in a session.
|
||||
|
||||
record_in_processes:
|
||||
- 'main'
|
||||
products:
|
||||
- 'firefox'
|
||||
- 'fennec'
|
||||
expires: "102"
|
||||
kind: uint
|
||||
bug_numbers:
|
||||
- 1740335
|
||||
notification_emails:
|
||||
- sw-telemetry@mozilla.com
|
||||
- rjesup@mozilla.com
|
||||
- echuang@mozilla.com
|
||||
keyed: true
|
||||
keys:
|
||||
- All
|
||||
- Fetch
|
||||
|
||||
widget:
|
||||
ime_name_on_windows:
|
||||
bug_numbers:
|
||||
|
Loading…
Reference in New Issue
Block a user