Bug 1923028 - Migrate scalars to use Glean APIs for dom.*, r=chutten.

Differential Revision: https://phabricator.services.mozilla.com/D226688
This commit is contained in:
Florian Quèze 2024-10-24 10:52:57 +00:00
parent 73f15b57e9
commit 9c9981f0e3
7 changed files with 167 additions and 24 deletions

View File

@ -522,7 +522,7 @@ export var TabCrashHandler = {
// Make sure to only count once even if there are multiple windows
// that will all show about:restartrequired.
if (this._crashedTabCount == 1) {
Services.telemetry.scalarAdd("dom.contentprocess.buildID_mismatch", 1);
Glean.domContentprocess.buildIdMismatch.add(1);
}
},

View File

@ -39,7 +39,7 @@
#include "mozilla/StaticPrefs_browser.h"
#include "mozilla/StaticPrefs_docshell.h"
#include "mozilla/StaticPrefs_fission.h"
#include "mozilla/Telemetry.h"
#include "mozilla/glean/GleanMetrics.h"
#include "nsILayoutHistoryState.h"
#include "nsIPrintSettings.h"
#include "nsIPrintSettingsService.h"
@ -93,9 +93,7 @@ static void IncreasePrivateCount() {
static bool sHasSeenPrivateContext = false;
if (!sHasSeenPrivateContext) {
sHasSeenPrivateContext = true;
mozilla::Telemetry::ScalarSet(
mozilla::Telemetry::ScalarID::DOM_PARENTPROCESS_PRIVATE_WINDOW_USED,
true);
mozilla::glean::dom_parentprocess::private_window_used.Set(true);
}
}

View File

@ -2377,7 +2377,7 @@ Document::~Document() {
// don't report for about: pages
if (!IsAboutPage()) {
if (MOZ_UNLIKELY(mMathMLEnabled)) {
ScalarAdd(Telemetry::ScalarID::MATHML_DOC_COUNT, 1);
glean::mathml::doc_count.Add(1);
}
}
}

View File

@ -141,7 +141,7 @@
#endif
#if defined(MOZ_TELEMETRY_REPORTING)
# include "mozilla/Telemetry.h"
# include "mozilla/glean/GleanMetrics.h"
#endif // defined(MOZ_TELEMETRY_REPORTING)
using namespace mozilla;
@ -3722,9 +3722,7 @@ void nsFrameLoader::MaybeNotifyCrashed(BrowsingContext* aBrowsingContext,
#if defined(MOZ_TELEMETRY_REPORTING)
if (sendTelemetry) {
Telemetry::ScalarAdd(
Telemetry::ScalarID::DOM_CONTENTPROCESS_BUILDID_MISMATCH_FALSE_POSITIVE,
1);
glean::dom_contentprocess::build_id_mismatch_false_positive.Add(1);
}
#endif // defined(MOZ_TELEMETRY_REPORTING)

View File

@ -19,7 +19,7 @@
#include "mozilla/Services.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/StaticPrefs_threads.h"
#include "mozilla/Telemetry.h"
#include "mozilla/glean/GleanMetrics.h"
#include "mozilla/Unused.h"
#include "mozilla/Logging.h"
#include "nsPrintfCString.h"
@ -525,8 +525,7 @@ void ProcessPriorityManagerImpl::BrowserPriorityChanged(
return;
}
Telemetry::ScalarAdd(
Telemetry::ScalarID::DOM_CONTENTPROCESS_OS_PRIORITY_CHANGE_CONSIDERED, 1);
glean::dom_contentprocess::os_priority_change_considered.Add(1);
aBC->SetPriorityActive(aPriority);
@ -550,9 +549,7 @@ void ProcessPriorityManagerImpl::BrowserPriorityChanged(
if (RefPtr pppm =
GetParticularProcessPriorityManager(aBrowserParent->Manager())) {
Telemetry::ScalarAdd(
Telemetry::ScalarID::DOM_CONTENTPROCESS_OS_PRIORITY_CHANGE_CONSIDERED,
1);
glean::dom_contentprocess::os_priority_change_considered.Add(1);
pppm->BrowserPriorityChanged(aBrowserParent, aPriority);
}
}
@ -811,11 +808,9 @@ void ParticularProcessPriorityManager::SetPriorityNow(
// transitioning from the PROCESS_PRIORITY_UNKNOWN level, which is where
// we initialize at.
if (oldPriority < mPriority && oldPriority != PROCESS_PRIORITY_UNKNOWN) {
Telemetry::ScalarAdd(
Telemetry::ScalarID::DOM_CONTENTPROCESS_OS_PRIORITY_RAISED, 1);
glean::dom_contentprocess::os_priority_raised.Add(1);
} else if (oldPriority > mPriority) {
Telemetry::ScalarAdd(
Telemetry::ScalarID::DOM_CONTENTPROCESS_OS_PRIORITY_LOWERED, 1);
glean::dom_contentprocess::os_priority_lowered.Add(1);
}
ProcessPriorityManagerImpl::SetProcessPriorityIfEnabled(Pid(), mPriority);

View File

@ -578,3 +578,155 @@ security:
If the principal is a ContentPrincipal, we also collect the scheme
type: string
telemetry_mirror: Security_Fissionprincipals_Contentparent
mathml:
doc_count:
type: counter
description: >
The number of documents that contained enabled MathML elements.
This metric was generated to correspond to the Legacy Telemetry
scalar mathml.doc_count.
bugs:
- https://bugzil.la/1362187
- https://bugzil.la/1538985
- https://bugzil.la/1590350
data_reviews:
- https://bugzil.la/1362187
- https://bugzil.la/1538985
- https://bugzil.la/1590350
notification_emails:
- emilio@mozilla.com
- fred.wang@free.fr
- dev-tech-layout@lists.mozilla.org
expires: never
telemetry_mirror: MATHML_DOC_COUNT
dom.contentprocess:
build_id_mismatch:
type: counter
description: >
The number of times the about:restartrequired page appeared due to a
buildID mismatch between the parent and the content processes.
This metric was generated to correspond to the Legacy Telemetry
scalar dom.contentprocess.buildID_mismatch.
bugs:
- https://bugzil.la/1366808
data_reviews:
- https://bugzil.la/1366808
notification_emails:
- spohl@mozilla.com
expires: never
telemetry_mirror: DOM_CONTENTPROCESS_BUILDID_MISMATCH
build_id_mismatch_false_positive:
type: counter
description: >
The number of times a process crashed early but we could verify it
was not because of buildID mismatch between the parent and the
content processes.
This metric was generated to correspond to the Legacy Telemetry
scalar dom.contentprocess.buildID_mismatch_false_positive.
bugs:
- https://bugzil.la/1651133
- https://bugzil.la/1730045
- https://bugzil.la/1754658
- https://bugzil.la/1777404
- https://bugzil.la/1817104
- https://bugzil.la/1866197
data_reviews:
- https://bugzil.la/1651133
- https://bugzil.la/1730045
- https://bugzil.la/1754658
- https://bugzil.la/1777404
- https://bugzil.la/1817104
- https://bugzil.la/1866197
notification_emails:
- alissy@mozilla.com
expires: 135
telemetry_mirror: DOM_CONTENTPROCESS_BUILDID_MISMATCH_FALSE_POSITIVE
os_priority_lowered:
type: counter
description: >
The number of times a content process has had its OS priority
lowered due to only containing background tabs without audible media
playing.
This metric was generated to correspond to the Legacy Telemetry
scalar dom.contentprocess.os_priority_lowered.
bugs:
- https://bugzil.la/1538987
data_reviews:
- https://bugzil.la/1538987
notification_emails:
- mconley@mozilla.com
- gsvelto@mozilla.com
expires: never
telemetry_mirror: DOM_CONTENTPROCESS_OS_PRIORITY_LOWERED
os_priority_raised:
type: counter
description: >
The number of times a content process has had its OS priority raised
due to containing at least one foregrounded tab, or a tab with
audible media has started playing in it.
This metric was generated to correspond to the Legacy Telemetry
scalar dom.contentprocess.os_priority_raised.
bugs:
- https://bugzil.la/1538987
data_reviews:
- https://bugzil.la/1538987
notification_emails:
- mconley@mozilla.com
- gsvelto@mozilla.com
expires: never
telemetry_mirror: DOM_CONTENTPROCESS_OS_PRIORITY_RAISED
os_priority_change_considered:
type: counter
description: >
The number of times we've had the opportunity to change content
process priority due to a tab switch or a tab being opened.
This metric was generated to correspond to the Legacy Telemetry
scalar dom.contentprocess.os_priority_change_considered.
bugs:
- https://bugzil.la/1538987
data_reviews:
- https://bugzil.la/1538987
notification_emails:
- mconley@mozilla.com
- gsvelto@mozilla.com
expires: never
telemetry_mirror: DOM_CONTENTPROCESS_OS_PRIORITY_CHANGE_CONSIDERED
dom.parentprocess:
private_window_used:
type: boolean
description: >
Whether a private browsing window has been used in the session.
This metric was generated to correspond to the Legacy Telemetry
scalar dom.parentprocess.private_window_used.
bugs:
- https://bugzil.la/1491047
data_reviews:
- https://bugzil.la/1491047
notification_emails:
- seceng-telemetry@mozilla.com
- ehsan+telemetry@mozilla.com
expires: never
telemetry_mirror: DOM_PARENTPROCESS_PRIVATE_WINDOW_USED
process_launch_errors:
type: labeled_counter
description: >
Collect precise set of error code and calling site upon process
creation failure path.
This metric was generated to correspond to the Legacy Telemetry
scalar dom.parentprocess.process_launch_errors.
bugs:
- https://bugzil.la/1819311
data_reviews:
- https://bugzil.la/1819311
notification_emails:
- alissy@mozilla.com
expires: never
telemetry_mirror: DOM_PARENTPROCESS_PROCESS_LAUNCH_ERRORS

View File

@ -52,6 +52,7 @@
#include "mozilla/SharedThreadPool.h"
#include "mozilla/StaticMutex.h"
#include "mozilla/TaskQueue.h"
#include "mozilla/glean/GleanMetrics.h"
#include "mozilla/Telemetry.h"
#include "mozilla/UniquePtrExtensions.h"
#include "mozilla/ipc/BrowserProcessSubThread.h"
@ -825,10 +826,9 @@ bool GeckoChildProcessHost::AsyncLaunch(
.get());
telemetryKey.Truncate(72);
}
Telemetry::ScalarAdd(
Telemetry::ScalarID::
DOM_PARENTPROCESS_PROCESS_LAUNCH_ERRORS,
NS_ConvertUTF8toUTF16(telemetryKey), 1);
glean::dom_parentprocess::process_launch_errors
.Get(telemetryKey)
.Add(1);
{
MonitorAutoLock lock(mMonitor);
mProcessState = PROCESS_ERROR;