Bug 1507870 - add telemetry for accessibility panel tree context menu functionality. r=janerik, data-review=chutten
authorYura Zenevich <yura.zenevich@gmail.com>
Fri, 30 Nov 2018 14:56:00 +0000
changeset 508203 0ffc19c364e82f893b636540c19da0aa6ca36cc2
parent 508202 e226f18cbdff3984d023430bd6f52ca3e0de6f19
child 508204 ed149f9cf50a61f1a6f90f3163d89d809414d632
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjanerik
bugs1507870
milestone65.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 1507870 - add telemetry for accessibility panel tree context menu functionality. r=janerik, data-review=chutten MozReview-Commit-ID: 837WW3Emuk5 Differential Revision: https://phabricator.services.mozilla.com/D12505
devtools/client/accessibility/components/AccessibilityRow.js
toolkit/components/telemetry/Scalars.yaml
--- a/devtools/client/accessibility/components/AccessibilityRow.js
+++ b/devtools/client/accessibility/components/AccessibilityRow.js
@@ -1,14 +1,14 @@
 /* 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 gToolbox, EVENTS */
+/* global gTelemetry, gToolbox, EVENTS */
 
 // React & Redux
 const { Component, createFactory } = require("devtools/client/shared/vendor/react");
 const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
 const { findDOMNode } = require("devtools/client/shared/vendor/react-dom");
 const { connect } = require("devtools/client/shared/vendor/react-redux");
 
 const TreeRow = require("devtools/client/shared/components/tree/TreeRow");
@@ -25,16 +25,21 @@ const { unhighlight } = require("../acti
 
 const { L10N } = require("../utils/l10n");
 
 loader.lazyRequireGetter(this, "Menu", "devtools/client/framework/menu");
 loader.lazyRequireGetter(this, "MenuItem", "devtools/client/framework/menu-item");
 
 const JSON_URL_PREFIX = "data:application/json;charset=UTF-8,";
 
+const TELEMETRY_ACCESSIBLE_CONTEXT_MENU_OPENED =
+  "devtools.accessibility.accessible_context_menu_opened";
+const TELEMETRY_ACCESSIBLE_CONTEXT_MENU_ITEM_ACTIVATED =
+  "devtools.accessibility.accessible_context_menu_item_activated";
+
 class HighlightableTreeRowClass extends TreeRow {
   shouldComponentUpdate(nextProps) {
     const props = ["name", "open", "value", "loading", "selected", "hasChildren"];
 
     for (const p of props) {
       if (nextProps.member[p] !== this.props.member[p]) {
         return true;
       }
@@ -148,16 +153,21 @@ class AccessibilityRow extends Component
 
   async printToJSON() {
     const { member, supports } = this.props;
     if (!supports.snapshot) {
       // Debugger server does not support Accessible actor snapshots.
       return;
     }
 
+    if (gTelemetry) {
+      gTelemetry.keyedScalarAdd(TELEMETRY_ACCESSIBLE_CONTEXT_MENU_ITEM_ACTIVATED,
+                                "print-to-json", 1);
+    }
+
     const snapshot = await member.object.snapshot();
     openDocLink(`${JSON_URL_PREFIX}${encodeURIComponent(JSON.stringify(snapshot))}`);
   }
 
   onContextMenu(e) {
     e.stopPropagation();
     e.preventDefault();
 
@@ -172,16 +182,20 @@ class AccessibilityRow extends Component
       menu.append(new MenuItem({
         id: "menu-printtojson",
         label: L10N.getStr("accessibility.tree.menu.printToJSON"),
         click: () => this.printToJSON(),
       }));
     }
 
     menu.popup(e.screenX, e.screenY, gToolbox);
+
+    if (gTelemetry) {
+      gTelemetry.scalarAdd(TELEMETRY_ACCESSIBLE_CONTEXT_MENU_OPENED, 1);
+    }
   }
 
   get hasContextMenu() {
     const { supports } = this.props;
     return supports.snapshot;
   }
 
   /**
--- a/toolkit/components/telemetry/Scalars.yaml
+++ b/toolkit/components/telemetry/Scalars.yaml
@@ -1419,16 +1419,48 @@ devtools.accessibility:
     kind: uint
     notification_emails:
       - dev-developer-tools@lists.mozilla.org
       - yzenevich@mozilla.com
     release_channel_collection: opt-out
     record_in_processes:
       - 'main'
 
+  accessible_context_menu_opened:
+    bug_numbers:
+      - 1507870
+    description: >
+      Number of times a context menu was opened for an accessible object in the
+      accessibility tree.
+    expires: "70"
+    kind: uint
+    notification_emails:
+      - dev-developer-tools@lists.mozilla.org
+      - yzenevich@mozilla.com
+    release_channel_collection: opt-out
+    record_in_processes:
+      - 'main'
+
+  accessible_context_menu_item_activated:
+    bug_numbers:
+      - 1507870
+    description: >
+      Number of times a context menu item for an accessible object was activated (with
+      mouse or keyboard) from the context menu opened in the accessibility tree. Keyed by
+      the id of the context menu item.
+    expires: "70"
+    kind: uint
+    keyed: true
+    notification_emails:
+      - dev-developer-tools@lists.mozilla.org
+      - yzenevich@mozilla.com
+    release_channel_collection: opt-out
+    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