Bug 1960923 - Make MathML metric a use counter. r=fredw

That gives us consistent numbers to compare against.

Differential Revision: https://phabricator.services.mozilla.com/D245744
This commit is contained in:
Emilio Cobos Álvarez
2025-04-16 17:25:25 +00:00
parent 5df5cafc15
commit b4f7162b1e
6 changed files with 40 additions and 38 deletions

View File

@@ -1360,7 +1360,6 @@ Document::Document(const char* aContentType)
mRenderingSuppressedForViewTransitions(false),
mBidiEnabled(false),
mMayNeedFontPrefsUpdate(true),
mMathMLEnabled(false),
mIsInitialDocumentInWindow(false),
mIsEverInitialDocumentInWindow(false),
mIgnoreDocGroupMismatches(false),
@@ -2451,13 +2450,6 @@ Document::~Document() {
if (IsTopLevelContentDocument()) {
RemoveToplevelLoadingDocument(this);
// don't report for about: pages
if (!IsAboutPage()) {
if (MOZ_UNLIKELY(mMathMLEnabled)) {
glean::mathml::doc_count.Add(1);
}
}
}
mInDestructor = true;

View File

@@ -1000,8 +1000,6 @@ class Document : public nsINode,
*/
void SetBidiEnabled() { mBidiEnabled = true; }
void SetMathMLEnabled() { mMathMLEnabled = true; }
/**
* Ask this document whether it's the initial document in its window.
*/
@@ -4750,8 +4748,6 @@ class Document : public nsINode,
bool mBidiEnabled : 1;
// True if we may need to recompute the language prefs for this document.
bool mMayNeedFontPrefsUpdate : 1;
// True if a MathML element has ever been owned by this document.
bool mMathMLEnabled : 1;
// True if this document is the initial document for a window. This should
// basically be true only for documents that exist in newly-opened windows or

View File

@@ -459,6 +459,8 @@ custom TextDirectivePages used text fragments
custom InvalidTextDirectives had a text fragment that could not be found after loading has finished
custom TextDirectiveNotCreated has not succeeded in creating a text fragment
custom MathMLUsed has used MathML
// NOTE: You might need a data collection review if you are adding
// a custom use counter. And for WebIDL methods or attributes,
// deprecated operations, or CSS properties: you almost certainly

View File

@@ -107,8 +107,8 @@ use.counter:
send_in_pings:
- use-counters
# Total of 2389 use counter metrics (excludes denominators).
# Total of 354 'page' use counters.
# Total of 2391 use counter metrics (excludes denominators).
# Total of 355 'page' use counters.
use.counter.page:
svgsvgelement_getelementbyid:
type: counter
@@ -6128,7 +6128,24 @@ use.counter.page:
send_in_pings:
- use-counters
# Total of 354 'document' use counters.
math_mlused:
type: counter
description: >
Whether a page has used MathML.
Compare against `use.counter.top_level_content_documents_destroyed`
to calculate the rate.
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1852098
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1852098
notification_emails:
- dom-core@mozilla.com
- emilio@mozilla.com
expires: never
send_in_pings:
- use-counters
# Total of 355 'document' use counters.
use.counter.doc:
svgsvgelement_getelementbyid:
type: counter
@@ -12148,6 +12165,23 @@ use.counter.doc:
send_in_pings:
- use-counters
math_mlused:
type: counter
description: >
Whether a document has used MathML.
Compare against `use.counter.content_documents_destroyed`
to calculate the rate.
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1852098
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1852098
notification_emails:
- dom-core@mozilla.com
- emilio@mozilla.com
expires: never
send_in_pings:
- use-counters
# Total of 53 'dedicated worker' use counters.
use.counter.worker.dedicated:
pushmanager_subscribe:

View File

@@ -67,7 +67,7 @@ nsresult MathMLElement::BindToTree(BindContext& aContext, nsINode& aParent) {
// Set the bit in the document for telemetry.
if (Document* doc = aContext.GetComposedDoc()) {
doc->SetMathMLEnabled();
doc->SetUseCounter(eUseCounter_custom_MathMLUsed);
}
return rv;

View File

@@ -755,28 +755,6 @@ security:
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