Bug 1495910 - Add telemetry for record/replay menu items, r=lsmyth,janerik.
authorBrian Hackett <bhackett1024@gmail.com>
Wed, 17 Oct 2018 09:07:46 -0600
changeset 490450 040f0e314fcf3251acc978a87a9597c8f25983d1
parent 490448 ce6fcc65a415d3bee52757e3d5a97216ad27daa7
child 490451 a254c5207ba052f56527ea28d3dad50e0182cd33
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewerslsmyth, janerik
bugs1495910
milestone64.0a1
Bug 1495910 - Add telemetry for record/replay menu items, r=lsmyth,janerik.
devtools/client/webreplay/menu.js
toolkit/components/telemetry/Scalars.yaml
--- a/devtools/client/webreplay/menu.js
+++ b/devtools/client/webreplay/menu.js
@@ -16,63 +16,68 @@ function l10n(key) {
 
 const ChromeUtils = require("ChromeUtils");
 ChromeUtils.defineModuleGetter(this, "Services",
                                "resource://gre/modules/Services.jsm");
 
 function RecordNewTab() {
   const { gBrowser } = Services.wm.getMostRecentWindow("navigator:browser");
   gBrowser.selectedTab = gBrowser.addWebTab("about:blank", { recordExecution: "*" });
+  Services.telemetry.scalarAdd("devtools.webreplay.new_recording", 1);
 }
 
 function ReloadAndRecordTab() {
   const { gBrowser } = Services.wm.getMostRecentWindow("navigator:browser");
   const url = gBrowser.currentURI.spec;
   gBrowser.updateBrowserRemoteness(gBrowser.selectedBrowser, true,
                                    { recordExecution: "*", newFrameloader: true });
   gBrowser.loadURI(url, {
     triggeringPrincipal: gBrowser.selectedBrowser.contentPrincipal,
   });
+  Services.telemetry.scalarAdd("devtools.webreplay.reload_recording", 1);
 }
 
 function ReloadAndStopRecordingTab() {
   const { gBrowser } = Services.wm.getMostRecentWindow("navigator:browser");
   const url = gBrowser.currentURI.spec;
   gBrowser.updateBrowserRemoteness(gBrowser.selectedBrowser, true,
                                    { newFrameloader: true });
   gBrowser.loadURI(url, {
     triggeringPrincipal: gBrowser.selectedBrowser.contentPrincipal,
   });
+  Services.telemetry.scalarAdd("devtools.webreplay.stop_recording", 1);
 }
 
 function SaveRecording() {
   const { gBrowser } = Services.wm.getMostRecentWindow("navigator:browser");
   const fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
   const window = gBrowser.ownerGlobal;
   fp.init(window, null, Ci.nsIFilePicker.modeSave);
   fp.open(rv => {
     if (rv == Ci.nsIFilePicker.returnOK || rv == Ci.nsIFilePicker.returnReplace) {
       const tabParent = gBrowser.selectedTab.linkedBrowser.frameLoader.tabParent;
       if (!tabParent || !tabParent.saveRecording(fp.file.path)) {
         window.alert("Current tab is not recording");
       }
     }
   });
+  Services.telemetry.scalarAdd("devtools.webreplay.save_recording", 1);
 }
 
 function ReplayNewTab() {
   const { gBrowser } = Services.wm.getMostRecentWindow("navigator:browser");
   const fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
   const window = gBrowser.ownerGlobal;
   fp.init(window, null, Ci.nsIFilePicker.modeOpen);
   fp.open(rv => {
     if (rv == Ci.nsIFilePicker.returnOK || rv == Ci.nsIFilePicker.returnReplace) {
       gBrowser.selectedTab = gBrowser.addWebTab(null, { replayExecution: fp.file.path });
     }
   });
+  Services.telemetry.scalarAdd("devtools.webreplay.load_recording", 1);
 }
 
 const menuItems = [
   { id: "devtoolsRecordNewTab", command: RecordNewTab },
   { id: "devtoolsReloadAndRecordTab", command: ReloadAndRecordTab },
   { id: "devtoolsSaveRecording", command: SaveRecording },
   { id: "devtoolsReplayNewTab", command: ReplayNewTab },
 ];
--- a/toolkit/components/telemetry/Scalars.yaml
+++ b/toolkit/components/telemetry/Scalars.yaml
@@ -1485,16 +1485,77 @@ devtools.toolbox:
     keyed: true
     notification_emails:
       - dev-developer-tools@lists.mozilla.org
       - daisuke@mozilla.com
     release_channel_collection: opt-out
     record_in_processes:
       - 'main'
 
+devtools.webreplay:
+  new_recording:
+    bug_numbers:
+     - 1495910
+    description: >
+      Number of times a blank recording tab was created.
+    expires: never
+    kind: uint
+    notification_emails:
+     - bhackett@mozilla.com
+    record_in_processes:
+     - 'main'
+
+  reload_recording:
+    bug_numbers:
+     - 1495910
+    description: >
+      Number of times a non-recording tab was reloaded to create a recording tab.
+    expires: never
+    kind: uint
+    notification_emails:
+     - bhackett@mozilla.com
+    record_in_processes:
+     - 'main'
+
+  stop_recording:
+    bug_numbers:
+     - 1495910
+    description: >
+      Number of times a recording tab was reloaded to create a non-recording tab.
+    expires: never
+    kind: uint
+    notification_emails:
+     - bhackett@mozilla.com
+    record_in_processes:
+     - 'main'
+
+  save_recording:
+    bug_numbers:
+     - 1495910
+    description: >
+      Number of times a recording was saved.
+    expires: never
+    kind: uint
+    notification_emails:
+     - bhackett@mozilla.com
+    record_in_processes:
+     - 'main'
+
+  load_recording:
+    bug_numbers:
+     - 1495910
+    description: >
+      Number of times a recording was loaded.
+    expires: never
+    kind: uint
+    notification_emails:
+     - bhackett@mozilla.com
+    record_in_processes:
+     - 'main'
+
 navigator.storage:
   estimate_count:
     bug_numbers:
       - 1359708
     description: >
       Number of times navigator.storage.estimate has been used.
     expires: "60"
     kind: uint