Bug 1550794 - Add telemetry probe to count number of node selections. r=gl
authorRazvan Caliman <rcaliman@mozilla.com>
Fri, 17 May 2019 16:42:48 +0000
changeset 474498 7b90628fa1e7f153e574c07626b6af5378593a45
parent 474497 8749b486edc4a89d2938f6bdfab8571f3f1f576d
child 474499 319a369ccde4ff1c4842c62fe90e9adf4eb5c028
child 474500 807e0fabd519163758bcf5cfa63f7e7d2f1d9611
push id36040
push userrgurzau@mozilla.com
push dateMon, 20 May 2019 13:43:21 +0000
treeherdermozilla-central@319a369ccde4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgl
bugs1550794
milestone68.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 1550794 - Add telemetry probe to count number of node selections. r=gl Adds a new permanent telemetry probe (scalar) to count the number of times a node selection is made in the Inspector. This count will be correlated with other existing probes (open count, duration open) to establish a more accurate baseline for Inspector usage and correct for accidental usage. When opening the Inspector via the context menu ("Inspect Element"), the selection is counted twice: once when automatically selecting the `<body>` to build the dom tree and once more for selecting the actual target node. This side-effect does not pollute our data. We assign a higher weight to the behavior of "Inspect Element" as being intentional usage of the Inspector so the higher node selection count works in our favor. Differential Revision: https://phabricator.services.mozilla.com/D31231
devtools/client/inspector/inspector.js
toolkit/components/telemetry/Scalars.yaml
--- a/devtools/client/inspector/inspector.js
+++ b/devtools/client/inspector/inspector.js
@@ -50,16 +50,17 @@ const PORTRAIT_MODE_WIDTH_THRESHOLD = 70
 // the sidebar automatically switches from 'landscape/horizontal' to 'portrait/vertical'
 // mode.
 const SIDE_PORTAIT_MODE_WIDTH_THRESHOLD = 1000;
 
 const THREE_PANE_ENABLED_PREF = "devtools.inspector.three-pane-enabled";
 const THREE_PANE_ENABLED_SCALAR = "devtools.inspector.three_pane_enabled";
 const THREE_PANE_CHROME_ENABLED_PREF = "devtools.inspector.chrome.three-pane-enabled";
 const TELEMETRY_EYEDROPPER_OPENED = "devtools.toolbar.eyedropper.opened";
+const TELEMETRY_SCALAR_NODE_SELECTION_COUNT = "devtools.inspector.node_selection_count";
 
 /**
  * Represents an open instance of the Inspector for a tab.
  * The inspector controls the breadcrumbs, the markup view, and the sidebar
  * (computed view, rule view, font view and animation inspector).
  *
  * Events:
  * - ready
@@ -1294,16 +1295,17 @@ Inspector.prototype = {
 
     this.updateAddElementButton();
     this.updateSelectionCssSelector();
 
     const selfUpdate = this.updating("inspector-panel");
     executeSoon(() => {
       try {
         selfUpdate(this.selection.nodeFront);
+        this.telemetry.scalarAdd(TELEMETRY_SCALAR_NODE_SELECTION_COUNT, 1);
       } catch (ex) {
         console.error(ex);
       }
     });
   },
 
   /**
    * Delay the "inspector-updated" notification while a tool
--- a/toolkit/components/telemetry/Scalars.yaml
+++ b/toolkit/components/telemetry/Scalars.yaml
@@ -1428,16 +1428,31 @@ devtools.inspector:
     kind: uint
     notification_emails:
       - dev-developer-tools@lists.mozilla.org
       - mbalfanz@mozilla.com
     release_channel_collection: opt-out
     record_in_processes:
       - 'main'
 
+  node_selection_count:
+    bug_numbers:
+      - 1550794
+    description: >
+      Number of times a different node is marked as selected in the Inspector regardless
+      of the cause: context menu, manual selection in markup view, etc.
+    expires: "never"
+    kind: uint
+    notification_emails:
+      - dev-developer-tools@lists.mozilla.org
+      - mbalfanz@mozilla.com
+    release_channel_collection: opt-out
+    record_in_processes:
+      - 'main'
+
 devtools.shadowdom:
   shadow_root_displayed:
     bug_numbers:
       - 1470128
     description: >
       Whether the markup view displayed any #shadow-root element in the UI.
     expires: "66"
     kind: boolean