From 529c78906ff42eb8f3b3e296c6937706c9940cd5 Mon Sep 17 00:00:00 2001 From: Mike Conley Date: Tue, 8 Jun 2021 16:09:22 +0000 Subject: [PATCH] Bug 1715129 - Collect telemetry on how many clients have Proton enabled. r=chutten data-review=chutten Differential Revision: https://phabricator.services.mozilla.com/D117093 --- browser/base/content/metrics.yaml | 22 ++++++++++++++++++++++ browser/components/BrowserGlue.jsm | 16 ++++++++++++++++ toolkit/components/glean/metrics_index.py | 1 + 3 files changed, 39 insertions(+) create mode 100644 browser/base/content/metrics.yaml diff --git a/browser/base/content/metrics.yaml b/browser/base/content/metrics.yaml new file mode 100644 index 000000000000..84dc78ddeab0 --- /dev/null +++ b/browser/base/content/metrics.yaml @@ -0,0 +1,22 @@ +# 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/. + +--- +$schema: moz://mozilla.org/schemas/glean/metrics/1-0-0 + +browser.ui: + proton_enabled: + type: boolean + description: > + True if the Proton default theme is enabled. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1715129 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1715129#c3 + data_sensitivity: + - technical + notification_emails: + - mconley@mozilla.com + - bwinton@mozilla.com + expires: "92" diff --git a/browser/components/BrowserGlue.jsm b/browser/components/BrowserGlue.jsm index e262defa1a70..795e380e7b65 100644 --- a/browser/components/BrowserGlue.jsm +++ b/browser/components/BrowserGlue.jsm @@ -17,6 +17,8 @@ const { AppConstants } = ChromeUtils.import( "resource://gre/modules/AppConstants.jsm" ); +Cu.importGlobalProperties(["Glean"]); + XPCOMUtils.defineLazyModuleGetters(this, { AboutNewTab: "resource:///modules/AboutNewTab.jsm", ActorManagerParent: "resource://gre/modules/ActorManagerParent.jsm", @@ -2535,6 +2537,12 @@ BrowserGlue.prototype = { }, }, + { + task: () => { + this._collectProtonTelemetry(); + }, + }, + // WebDriver components (Remote Agent and Marionette) need to be // initialized as very last step. { @@ -4225,6 +4233,14 @@ BrowserGlue.prototype = { } }, + _collectProtonTelemetry() { + let protonEnabled = Services.prefs.getBoolPref( + "browser.proton.enabled", + true + ); + Glean.browserUi.protonEnabled.set(protonEnabled); + }, + QueryInterface: ChromeUtils.generateQI([ "nsIObserver", "nsISupportsWeakReference", diff --git a/toolkit/components/glean/metrics_index.py b/toolkit/components/glean/metrics_index.py index 233e814d4c78..b539bfd0c046 100644 --- a/toolkit/components/glean/metrics_index.py +++ b/toolkit/components/glean/metrics_index.py @@ -10,6 +10,7 @@ metrics_yamls = [ "toolkit/components/glean/metrics.yaml", "toolkit/components/glean/test_metrics.yaml", "toolkit/mozapps/update/metrics.yaml", + "browser/base/content/metrics.yaml", ] # The list of all Glean pings.yaml files, relative to the top src dir.