From b83ebbd3042d15e79f7a1d25aaa7963ec723e02f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Qu=C3=A8ze?= Date: Thu, 7 Nov 2024 20:42:03 +0000 Subject: [PATCH] Bug 1927093 - Migrate scalars to use Glean APIs for devtools.responsive.*, r=chutten. Depends on D228155 Differential Revision: https://phabricator.services.mozilla.com/D228156 --- devtools/client/responsive/manager.js | 8 +--- devtools/client/responsive/metrics.yaml | 45 +++++++++++++++++++++++ toolkit/components/glean/metrics_index.py | 1 + 3 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 devtools/client/responsive/metrics.yaml diff --git a/devtools/client/responsive/manager.js b/devtools/client/responsive/manager.js index 51790c9f2c72..d11c560203fb 100644 --- a/devtools/client/responsive/manager.js +++ b/devtools/client/responsive/manager.js @@ -151,7 +151,7 @@ class ResponsiveUIManager { const hasToolbox = !!toolbox; if (hasToolbox) { - this.telemetry.scalarAdd("devtools.responsive.toolbox_opened_first", 1); + Glean.devtoolsResponsive.toolboxOpenedFirst.add(1); } this.telemetry.recordEvent("activate", "responsive_design", null, { @@ -164,11 +164,7 @@ class ResponsiveUIManager { if (!trigger) { trigger = "unknown"; } - this.telemetry.keyedScalarAdd( - "devtools.responsive.open_trigger", - trigger, - 1 - ); + Glean.devtoolsResponsive.openTrigger[trigger].add(1); } /** diff --git a/devtools/client/responsive/metrics.yaml b/devtools/client/responsive/metrics.yaml new file mode 100644 index 000000000000..f23dc4fa42a3 --- /dev/null +++ b/devtools/client/responsive/metrics.yaml @@ -0,0 +1,45 @@ +# 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: + - 'DevTools :: Responsive Design Mode' + +devtools.responsive: + open_trigger: + type: labeled_counter + description: > + Number of Responsive Design Mode opens keyed by the UI entry point + used. + This metric was generated to correspond to the Legacy Telemetry + scalar devtools.responsive.open_trigger. + bugs: + - https://bugzil.la/1444497 + data_reviews: + - https://bugzil.la/1444497 + notification_emails: + - dev-developer-tools@lists.mozilla.org + - jryans@mozilla.com + expires: never + telemetry_mirror: DEVTOOLS_RESPONSIVE_OPEN_TRIGGER + + toolbox_opened_first: + type: counter + description: > + Number of Responsive Design Mode opens with a toolbox already open. + This metric was generated to correspond to the Legacy Telemetry + scalar devtools.responsive.toolbox_opened_first. + bugs: + - https://bugzil.la/1444497 + data_reviews: + - https://bugzil.la/1444497 + notification_emails: + - dev-developer-tools@lists.mozilla.org + - jryans@mozilla.com + expires: never + telemetry_mirror: DEVTOOLS_RESPONSIVE_TOOLBOX_OPENED_FIRST diff --git a/toolkit/components/glean/metrics_index.py b/toolkit/components/glean/metrics_index.py index f6f7f5fc0f26..4bb2e9cd1a62 100644 --- a/toolkit/components/glean/metrics_index.py +++ b/toolkit/components/glean/metrics_index.py @@ -18,6 +18,7 @@ gecko_metrics = [ "accessible/metrics.yaml", "browser/base/content/metrics.yaml", "devtools/client/accessibility/metrics.yaml", + "devtools/client/responsive/metrics.yaml", "devtools/client/shared/metrics.yaml", "docshell/base/metrics.yaml", "dom/base/use_counter_metrics.yaml",