Bug 1463092 - Instrument inspection of 'Jump to Source' in the Web Console with event telemetry r?jdescottes draft
authorMichael Ratcliffe <mratcliffe@mozilla.com>
Fri, 22 Jun 2018 16:56:51 +0100
changeset 812759 654771093900923a2d858ba0540b0b5cf90fee24
parent 812731 35f2a64e55805d957fb951a16123165a42ce972d
child 813089 49e2d0fd55286545bd25b96f2eecb5574c843249
child 813124 f82d4c1c0b156c45b5e7855c4cd28b6e343d8341
push id114665
push usermratcliffe@mozilla.com
push dateFri, 29 Jun 2018 22:49:41 +0000
reviewersjdescottes
bugs1463092
milestone63.0a1
Bug 1463092 - Instrument inspection of 'Jump to Source' in the Web Console with event telemetry r?jdescottes MozReview-Commit-ID: DF54uBCDX1n
devtools/client/webconsole/webconsole-output-wrapper.js
toolkit/components/telemetry/Events.yaml
--- a/devtools/client/webconsole/webconsole-output-wrapper.js
+++ b/devtools/client/webconsole/webconsole-output-wrapper.js
@@ -30,17 +30,17 @@ function WebConsoleOutputWrapper(parentN
 
   this.init = this.init.bind(this);
 
   this.queuedMessageAdds = [];
   this.queuedMessageUpdates = [];
   this.queuedRequestUpdates = [];
   this.throttledDispatchPromise = null;
 
-  this._telemetry = new Telemetry();
+  this.telemetry = new Telemetry();
 
   store = configureStore(this.hud);
 }
 
 WebConsoleOutputWrapper.prototype = {
   init: function() {
     return new Promise((resolve) => {
       const attachRefToHud = (id, node) => {
@@ -158,28 +158,39 @@ WebConsoleOutputWrapper.prototype = {
         menu.popup(screenX, screenY, { doc: this.owner.chromeWindow.document });
 
         return menu;
       };
 
       if (this.toolbox) {
         Object.assign(serviceContainer, {
           onViewSourceInDebugger: frame => {
-            this.toolbox.viewSourceInDebugger(frame.url, frame.line).then(() =>
-              this.hud.emit("source-in-debugger-opened")
-            );
+            this.toolbox.viewSourceInDebugger(frame.url, frame.line).then(() => {
+              this.telemetry.recordEvent("devtools.main", "jump_to_source", "webconsole",
+                                         null, { "session_id": this.toolbox.sessionId }
+              );
+              this.hud.emit("source-in-debugger-opened");
+            });
           },
           onViewSourceInScratchpad: frame => this.toolbox.viewSourceInScratchpad(
             frame.url,
             frame.line
-          ),
+          ).then(() => {
+            this.telemetry.recordEvent("devtools.main", "jump_to_source", "webconsole",
+                                       null, { "session_id": this.toolbox.sessionId }
+            );
+          }),
           onViewSourceInStyleEditor: frame => this.toolbox.viewSourceInStyleEditor(
             frame.url,
             frame.line
-          ),
+          ).then(() => {
+            this.telemetry.recordEvent("devtools.main", "jump_to_source", "webconsole",
+                                       null, { "session_id": this.toolbox.sessionId }
+            );
+          }),
           openNetworkPanel: (requestId) => {
             return this.toolbox.selectTool("netmonitor").then((panel) => {
               return panel.panelWin.Netmonitor.inspectRequest(requestId);
             });
           },
           sourceMapService: this.toolbox ? this.toolbox.sourceMapURLService : null,
           highlightDomElement: (grip, options = {}) => {
             return this.toolbox.highlighterUtils
@@ -388,17 +399,17 @@ WebConsoleOutputWrapper.prototype = {
 
     this.throttledDispatchPromise = new Promise(done => {
       setTimeout(() => {
         this.throttledDispatchPromise = null;
 
         store.dispatch(actions.messagesAdd(this.queuedMessageAdds));
 
         const length = this.queuedMessageAdds.length;
-        this._telemetry.addEventProperty(
+        this.telemetry.addEventProperty(
           "devtools.main", "enter", "webconsole", null, "message_count", length);
 
         this.queuedMessageAdds = [];
 
         if (this.queuedMessageUpdates.length > 0) {
           this.queuedMessageUpdates.forEach(({ message, res }) => {
             store.dispatch(actions.networkMessageUpdate(message, null, res));
             this.hud.emit("network-message-updated", res);
--- a/toolkit/components/telemetry/Events.yaml
+++ b/toolkit/components/telemetry/Events.yaml
@@ -593,8 +593,18 @@ devtools.main:
     bug_numbers: [1463126]
     notification_emails: ["dev-developer-tools@lists.mozilla.org", "hkirschner@mozilla.com"]
     record_in_processes: ["main"]
     description: User clicked the blackbox button to blackbox a script.
     release_channel_collection: opt-out
     expiry_version: never
     extra_keys:
       session_id: The start time of the session in milliseconds since epoch (Unix Timestamp) e.g. 1396381378123.
+  jump_to_source:
+    objects: ["webconsole"]
+    bug_numbers: [1463092]
+    notification_emails: ["dev-developer-tools@lists.mozilla.org", "hkirschner@mozilla.com"]
+    record_in_processes: ["main"]
+    description: User has clicked a link to a source file in the web console.
+    release_channel_collection: opt-out
+    expiry_version: never
+    extra_keys:
+      session_id: The start time of the session in milliseconds since epoch (Unix Timestamp) e.g. 1396381378123.