Bug 1944631 - Migrate histograms to use Glean APIs in dom/storage, r=chutten.
Differential Revision: https://phabricator.services.mozilla.com/D235631
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "nsDOMString.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/glean/DomStorageMetrics.h"
|
||||
#include "nsProxyRelease.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
@@ -237,8 +238,11 @@ void LocalStorageCache::WaitForPreload() {
|
||||
// Telemetry of rates of pending preloads
|
||||
if (!mPreloadTelemetryRecorded) {
|
||||
mPreloadTelemetryRecorded = true;
|
||||
Telemetry::Accumulate(
|
||||
Telemetry::LOCALDOMSTORAGE_PRELOAD_PENDING_ON_FIRST_ACCESS, !loaded);
|
||||
glean::localdomstorage::preload_pending_on_first_access
|
||||
.EnumGet(static_cast<
|
||||
glean::localdomstorage::PreloadPendingOnFirstAccessLabel>(
|
||||
!loaded))
|
||||
.Add();
|
||||
}
|
||||
|
||||
if (loaded) {
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "nsTHashMap.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/Atomics.h"
|
||||
|
||||
namespace mozilla::dom {
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "mozIStorageValueArray.h"
|
||||
#include "mozIStorageFunction.h"
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
#include "mozilla/glean/DomStorageMetrics.h"
|
||||
#include "mozilla/ipc/BackgroundParent.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsThread.h"
|
||||
@@ -248,7 +249,7 @@ nsresult StorageDBThread::Shutdown() {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
Telemetry::AutoTimer<Telemetry::LOCALDOMSTORAGE_SHUTDOWN_DATABASE_MS> timer;
|
||||
auto timer = glean::localdomstorage::shutdown_database.Measure();
|
||||
|
||||
{
|
||||
MonitorAutoLock monitor(mThreadObserver->GetMonitor());
|
||||
|
||||
49
dom/storage/metrics.yaml
Normal file
49
dom/storage/metrics.yaml
Normal file
@@ -0,0 +1,49 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# Adding a new metric? We have docs for that!
|
||||
# https://firefox-source-docs.mozilla.org/toolkit/components/glean/user/new_definitions_file.html
|
||||
|
||||
---
|
||||
$schema: moz://mozilla.org/schemas/glean/metrics/2-0-0
|
||||
$tags:
|
||||
- 'Core :: Storage: localStorage & sessionStorage'
|
||||
|
||||
localdomstorage:
|
||||
shutdown_database:
|
||||
type: timing_distribution
|
||||
description: >
|
||||
Time to flush and close the localStorage database (ms)
|
||||
|
||||
This metric was generated to correspond to the Legacy Telemetry
|
||||
exponential histogram LOCALDOMSTORAGE_SHUTDOWN_DATABASE_MS.
|
||||
time_unit: millisecond
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1935420
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1935420
|
||||
notification_emails:
|
||||
- storage-telemetry@mozilla.com
|
||||
expires: never
|
||||
telemetry_mirror: LOCALDOMSTORAGE_SHUTDOWN_DATABASE_MS
|
||||
|
||||
preload_pending_on_first_access:
|
||||
type: labeled_counter
|
||||
description: >
|
||||
True when we had to wait for a pending preload on first access to
|
||||
localStorage data, false otherwise
|
||||
|
||||
This metric was generated to correspond to the Legacy Telemetry boolean
|
||||
histogram LOCALDOMSTORAGE_PRELOAD_PENDING_ON_FIRST_ACCESS.
|
||||
labels:
|
||||
- "false"
|
||||
- "true"
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1935420
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1935420
|
||||
notification_emails:
|
||||
- storage-telemetry@mozilla.com
|
||||
expires: never
|
||||
telemetry_mirror: h#LOCALDOMSTORAGE_PRELOAD_PENDING_ON_FIRST_ACCESS
|
||||
@@ -39,6 +39,7 @@ gecko_metrics = [
|
||||
"dom/push/metrics.yaml",
|
||||
"dom/quota/metrics.yaml",
|
||||
"dom/security/metrics.yaml",
|
||||
"dom/storage/metrics.yaml",
|
||||
"dom/webauthn/metrics.yaml",
|
||||
"gfx/metrics.yaml",
|
||||
"image/decoders/metrics.yaml",
|
||||
|
||||
Reference in New Issue
Block a user