Bug 1567200 - Add telemetry for simulation menu usage, r=yzen
authorMaliha Islam <mislam@mozilla.com>
Fri, 30 Aug 2019 03:14:51 +0000
changeset 490810 1581357c9e7b5548064334de939db9290e19a7e1
parent 490809 a8bcdfbce01be293b4936c5fb744c71bf35d1d00
child 490811 e0978ab17d5de76c867628599269621e5dd36b59
push id94053
push useryura.zenevich@gmail.com
push dateFri, 30 Aug 2019 04:43:13 +0000
treeherderautoland@1581357c9e7b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyzen
bugs1567200
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1567200 - Add telemetry for simulation menu usage, r=yzen Differential Revision: https://phabricator.services.mozilla.com/D42254
devtools/client/accessibility/components/SimulationMenuButton.js
toolkit/components/telemetry/Scalars.yaml
--- a/devtools/client/accessibility/components/SimulationMenuButton.js
+++ b/devtools/client/accessibility/components/SimulationMenuButton.js
@@ -1,13 +1,15 @@
 /* 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/. */
 "use strict";
 
+/* global gTelemetry */
+
 // React
 const {
   createFactory,
   Component,
 } = require("devtools/client/shared/vendor/react");
 const {
   hr,
   span,
@@ -34,16 +36,18 @@ loader.lazyGetter(this, "MenuItem", func
   );
 });
 loader.lazyGetter(this, "MenuList", function() {
   return createFactory(
     require("devtools/client/shared/components/menu/MenuList")
   );
 });
 
+const TELEMETRY_SIMULATION_ACTIVATED =
+  "devtools.accessibility.simulation_activated";
 const SIMULATION_MENU_LABELS = {
   NONE: "accessibility.filter.none",
   [SIMULATION_TYPE.DEUTERANOMALY]: "accessibility.simulation.deuteranomaly",
   [SIMULATION_TYPE.PROTANOMALY]: "accessibility.simulation.protanomaly",
   [SIMULATION_TYPE.PROTANOPIA]: "accessibility.simulation.protanopia",
   [SIMULATION_TYPE.DEUTERANOPIA]: "accessibility.simulation.deuteranopia",
   [SIMULATION_TYPE.TRITANOPIA]: "accessibility.simulation.tritanopia",
   [SIMULATION_TYPE.TRITANOMALY]: "accessibility.simulation.tritanomaly",
@@ -70,21 +74,26 @@ class SimulationMenuButton extends Compo
     const { dispatch, simulator } = this.props;
 
     dispatch(actions.simulate(simulator));
   }
 
   toggleSimulation(simKey) {
     const { dispatch, simulation, simulator } = this.props;
 
-    if (simulation[simKey]) {
-      this.disableSimulation();
-    } else {
+    if (!simulation[simKey]) {
+      if (gTelemetry) {
+        gTelemetry.keyedScalarAdd(TELEMETRY_SIMULATION_ACTIVATED, simKey, 1);
+      }
+
       dispatch(actions.simulate(simulator, [simKey]));
+      return;
     }
+
+    this.disableSimulation();
   }
 
   render() {
     const { simulation } = this.props;
     const simulationMenuButtonId = "simulation-menu-button";
     const toolbarLabelID = "accessibility-simulation-label";
     const currSimulation = Object.entries(simulation).find(
       simEntry => simEntry[1]
--- a/toolkit/components/telemetry/Scalars.yaml
+++ b/toolkit/components/telemetry/Scalars.yaml
@@ -2086,16 +2086,38 @@ devtools.accessibility:
     release_channel_collection: opt-out
     products:
       - 'firefox'
       - 'fennec'
       - 'geckoview'
     record_in_processes:
       - 'main'
 
+  simulation_activated:
+    bug_numbers:
+      - 1567200
+    description: >
+      Number of times accessibility simulation was activated (with mouse or keyboard)
+      from the accessibility panel's toolbar. Keyed by the simulation type
+      (e.g. "DEUTERANOMALY").
+    expires: "74"
+    kind: uint
+    keyed: true
+    notification_emails:
+      - dev-developer-tools@lists.mozilla.org
+      - yzenevich@mozilla.com
+      - mislam@mozilla.com
+    release_channel_collection: opt-out
+    products:
+      - 'firefox'
+      - 'fennec'
+      - 'geckoview'
+    record_in_processes:
+      - 'main'
+
 devtools.application:
   opened_count:
     bug_numbers:
       - 1451734
     description: >
       Number of times the DevTools Application panel has been opened.
     expires: "66"
     kind: uint