Bug 1203624 - Measure view source usage. r=mconley p=ally
authorJ. Ryan Stinnett <jryans@gmail.com>
Mon, 14 Sep 2015 18:42:01 -0500
changeset 296881 a88abc5e76ed7fc53b826531232df9ae3b939a58
parent 296880 6fed2baa96c9e0321a4cebe480ebb11059aa81c6
child 296900 bd52dfa335821853c69c2fa559edf3e59d55c6f5
child 296944 4121aaa473b8a26dba48798042c51904db1f82f7
push id962
push userjlund@mozilla.com
push dateFri, 04 Dec 2015 23:28:54 +0000
treeherdermozilla-release@23a2d286e80f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1203624
milestone43.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 1203624 - Measure view source usage. r=mconley p=ally
toolkit/components/telemetry/Histograms.json
toolkit/components/viewsource/content/viewSourceUtils.js
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -7347,16 +7347,34 @@
   "DEVTOOLS_PERFTOOLS_SELECTED_VIEW_MS": {
     "expires_in_version": "never",
     "kind": "exponential",
     "keyed": true,
     "high": "600000",
     "n_buckets": 20,
     "description": "The amount of time spent in a specific performance tool view, keyed by view name (waterfall, js-calltree, js-flamegraph, etc)."
   },
+  "VIEW_SOURCE_IN_BROWSER_OPENED_BOOLEAN": {
+    "alert_emails": ["mozilla-dev-developer-tools@lists.mozilla.org", "jryans@mozilla.com"],
+    "expires_in_version": "53",
+    "kind": "boolean",
+    "description": "How many times has view source in browser / tab been opened?"
+  },
+  "VIEW_SOURCE_IN_WINDOW_OPENED_BOOLEAN": {
+    "alert_emails": ["mozilla-dev-developer-tools@lists.mozilla.org", "jryans@mozilla.com"],
+    "expires_in_version": "53",
+    "kind": "boolean",
+    "description": "How many times has view source in a new window been opened?"
+  },
+  "VIEW_SOURCE_EXTERNAL_RESULT_BOOLEAN": {
+    "alert_emails": ["mozilla-dev-developer-tools@lists.mozilla.org", "jryans@mozilla.com"],
+    "expires_in_version": "53",
+    "kind": "boolean",
+    "description": "How many times has view source in an external editor been opened, and did it succeed?"
+  },
   "BROWSER_IS_USER_DEFAULT": {
     "expires_in_version": "never",
     "kind": "boolean",
     "releaseChannelCollection": "opt-out",
     "description": "The result of the startup default desktop browser check."
   },
   "BROWSER_IS_USER_DEFAULT_ERROR": {
     "expires_in_version": "never",
--- a/toolkit/components/viewsource/content/viewSourceUtils.js
+++ b/toolkit/components/viewsource/content/viewSourceUtils.js
@@ -83,16 +83,19 @@ var gViewSourceUtils = {
    *        outerWindowID (optional):
    *          The outerWindowID of the content window containing the document that
    *          we want to view the source of. Pass this if you want to attempt to
    *          load the document source out of the network cache.
    *        lineNumber (optional):
    *          The line number to focus on once the source is loaded.
    */
   viewSourceInBrowser: function(aArgs) {
+    Services.telemetry
+            .getHistogramById("VIEW_SOURCE_IN_BROWSER_OPENED_BOOLEAN")
+            .add(true);
     let viewSourceBrowser = new ViewSourceBrowser(aArgs.viewSourceBrowser);
     viewSourceBrowser.loadViewSource(aArgs);
   },
 
   /**
    * Displays view source for a selection from some document in the provided
    * <browser>.  This allows for non-window display methods, such as a tab from
    * Firefox.
@@ -151,16 +154,19 @@ var gViewSourceUtils = {
         isForcedCharset =
           aDocument.defaultView
                    .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
                    .getInterface(Components.interfaces.nsIDOMWindowUtils)
                    .docCharsetIsForced;
       } catch (ex) {
       }
     }
+    Services.telemetry
+            .getHistogramById("VIEW_SOURCE_IN_WINDOW_OPENED_BOOLEAN")
+            .add(true);
     openDialog("chrome://global/content/viewSource.xul",
                "_blank",
                "all,dialog=no",
                aArgsOrURL, charset, aPageDescriptor, aLineNumber, isForcedCharset);
   },
 
   buildEditorArgs: function(aPath, aLineNumber) {
     // Determine the command line arguments to pass to the editor.
@@ -335,17 +341,20 @@ var gViewSourceUtils = {
     if (!result) {
       this._openInInternalViewer(data.url, data.pageDescriptor, data.doc, data.lineNumber);
     }
   },
 
   // Calls the callback, keeping in mind undefined or null values.
   handleCallBack: function(aCallBack, result, data)
   {
-    // ifcallback is undefined, default to the internal viewer
+    Services.telemetry
+            .getHistogramById("VIEW_SOURCE_EXTERNAL_RESULT_BOOLEAN")
+            .add(result);
+    // if callback is undefined, default to the internal viewer
     if (aCallBack === undefined) {
       this.internalViewerFallback(result, data);
     } else if (aCallBack) {
       aCallBack(result, data);
     }
   },
 
   // Returns nsIProcess of the external view source editor or null