Bug 1956726 - Migrate histograms to use Glean APIs for STARTUP_CACHE_REQUESTS, r=chutten.
Differential Revision: https://phabricator.services.mozilla.com/D243957
This commit is contained in:
@@ -29,7 +29,7 @@
|
|||||||
#include "nsITimer.h"
|
#include "nsITimer.h"
|
||||||
#include "mozilla/Omnijar.h"
|
#include "mozilla/Omnijar.h"
|
||||||
#include "prenv.h"
|
#include "prenv.h"
|
||||||
#include "mozilla/Telemetry.h"
|
#include "mozilla/glean/StartupcacheMetrics.h"
|
||||||
#include "nsThreadUtils.h"
|
#include "nsThreadUtils.h"
|
||||||
#include "nsXULAppAPI.h"
|
#include "nsXULAppAPI.h"
|
||||||
#include "nsIProtocolHandler.h"
|
#include "nsIProtocolHandler.h"
|
||||||
@@ -377,10 +377,9 @@ nsresult StartupCache::GetBuffer(const char* id, const char** outbuf,
|
|||||||
NS_ASSERTION(NS_IsMainThread(),
|
NS_ASSERTION(NS_IsMainThread(),
|
||||||
"Startup cache only available on main thread");
|
"Startup cache only available on main thread");
|
||||||
|
|
||||||
Telemetry::LABELS_STARTUP_CACHE_REQUESTS label =
|
auto label = glean::startup_cache::RequestsLabel::eMiss;
|
||||||
Telemetry::LABELS_STARTUP_CACHE_REQUESTS::Miss;
|
auto telemetry = MakeScopeExit(
|
||||||
auto telemetry =
|
[&label] { glean::startup_cache::requests.EnumGet(label).Add(); });
|
||||||
MakeScopeExit([&label] { Telemetry::AccumulateCategorical(label); });
|
|
||||||
|
|
||||||
MutexAutoLock lock(mTableLock);
|
MutexAutoLock lock(mTableLock);
|
||||||
decltype(mTable)::Ptr p = mTable.lookup(nsDependentCString(id));
|
decltype(mTable)::Ptr p = mTable.lookup(nsDependentCString(id));
|
||||||
@@ -390,7 +389,7 @@ nsresult StartupCache::GetBuffer(const char* id, const char** outbuf,
|
|||||||
|
|
||||||
auto& value = p->value();
|
auto& value = p->value();
|
||||||
if (value.mData) {
|
if (value.mData) {
|
||||||
label = Telemetry::LABELS_STARTUP_CACHE_REQUESTS::HitMemory;
|
label = glean::startup_cache::RequestsLabel::eHitmemory;
|
||||||
} else {
|
} else {
|
||||||
if (!mCacheData.initialized()) {
|
if (!mCacheData.initialized()) {
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
return NS_ERROR_NOT_AVAILABLE;
|
||||||
@@ -432,7 +431,7 @@ nsresult StartupCache::GetBuffer(const char* id, const char** outbuf,
|
|||||||
|
|
||||||
MMAP_FAULT_HANDLER_CATCH(NS_ERROR_FAILURE)
|
MMAP_FAULT_HANDLER_CATCH(NS_ERROR_FAILURE)
|
||||||
|
|
||||||
label = Telemetry::LABELS_STARTUP_CACHE_REQUESTS::HitDisk;
|
label = glean::startup_cache::RequestsLabel::eHitdisk;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!value.mRequested) {
|
if (!value.mRequested) {
|
||||||
|
|||||||
43
startupcache/metrics.yaml
Normal file
43
startupcache/metrics.yaml
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# 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 :: XPCOM'
|
||||||
|
|
||||||
|
startup_cache:
|
||||||
|
requests:
|
||||||
|
type: labeled_counter
|
||||||
|
description: >
|
||||||
|
Record hits and misses to the startup cache, with categories.
|
||||||
|
|
||||||
|
This metric was generated to correspond to the Legacy Telemetry
|
||||||
|
categorical histogram STARTUP_CACHE_REQUESTS.
|
||||||
|
labels:
|
||||||
|
- HitMemory
|
||||||
|
- HitDisk
|
||||||
|
- Miss
|
||||||
|
bugs:
|
||||||
|
- https://bugzilla.mozilla.org/show_bug.cgi?id=1364235
|
||||||
|
- https://bugzilla.mozilla.org/show_bug.cgi?id=1590385
|
||||||
|
- https://bugzilla.mozilla.org/show_bug.cgi?id=1623098
|
||||||
|
- https://bugzilla.mozilla.org/show_bug.cgi?id=1649954
|
||||||
|
- https://bugzilla.mozilla.org/show_bug.cgi?id=1689257
|
||||||
|
- https://bugzilla.mozilla.org/show_bug.cgi?id=1754639
|
||||||
|
data_reviews:
|
||||||
|
- https://bugzilla.mozilla.org/show_bug.cgi?id=1364235
|
||||||
|
- https://bugzilla.mozilla.org/show_bug.cgi?id=1590385
|
||||||
|
- https://bugzilla.mozilla.org/show_bug.cgi?id=1623098
|
||||||
|
- https://bugzilla.mozilla.org/show_bug.cgi?id=1649954
|
||||||
|
- https://bugzilla.mozilla.org/show_bug.cgi?id=1689257
|
||||||
|
- https://bugzilla.mozilla.org/show_bug.cgi?id=1754639
|
||||||
|
notification_emails:
|
||||||
|
- dothayer@mozilla.com
|
||||||
|
- plawless@mozilla.com
|
||||||
|
expires: never
|
||||||
|
telemetry_mirror: h#STARTUP_CACHE_REQUESTS
|
||||||
@@ -65,6 +65,7 @@ gecko_metrics = [
|
|||||||
"security/manager/ssl/metrics.yaml",
|
"security/manager/ssl/metrics.yaml",
|
||||||
"services/common/metrics.yaml",
|
"services/common/metrics.yaml",
|
||||||
"services/sync/modules/metrics.yaml",
|
"services/sync/modules/metrics.yaml",
|
||||||
|
"startupcache/metrics.yaml",
|
||||||
"toolkit/components/antitracking/bouncetrackingprotection/metrics.yaml",
|
"toolkit/components/antitracking/bouncetrackingprotection/metrics.yaml",
|
||||||
"toolkit/components/antitracking/metrics.yaml",
|
"toolkit/components/antitracking/metrics.yaml",
|
||||||
"toolkit/components/captchadetection/metrics.yaml",
|
"toolkit/components/captchadetection/metrics.yaml",
|
||||||
|
|||||||
Reference in New Issue
Block a user