Bug 1287587 - Add Telemetry probes for user printing activities. r=mconley, data-review=liuche
authorThauã Silveira <thaua@hp.com>
Thu, 21 Jul 2016 13:57:00 -0400
changeset 348491 400da2ae93a1cad8ce9c6ce8bd329b290b453fc8
parent 348490 820961ff0369ddab74419085c64fac957d1be0b3
child 348492 74de16c8bed76a4c7885bb6a51c4933aac09029e
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1287587
milestone50.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 1287587 - Add Telemetry probes for user printing activities. r=mconley, data-review=liuche
toolkit/components/printing/content/printUtils.js
toolkit/components/telemetry/Histograms.json
toolkit/content/browser-content.js
--- a/toolkit/components/printing/content/printUtils.js
+++ b/toolkit/components/printing/content/printUtils.js
@@ -583,20 +583,22 @@ var PrintUtils = {
       printPreviewTB.setAttribute("fullscreentoolbar", true);
       printPreviewTB.id = "print-preview-toolbar";
 
       let navToolbox = this._listener.getNavToolbox();
       navToolbox.parentNode.insertBefore(printPreviewTB, navToolbox);
       printPreviewTB.initialize(ppBrowser);
 
       // Enable simplify page checkbox when the page is an article
-      if (this._sourceBrowser.isArticle)
+      if (this._sourceBrowser.isArticle) {
         printPreviewTB.enableSimplifyPage();
-      else
+      } else {
+        this.logTelemetry("PRINT_PREVIEW_SIMPLIFY_PAGE_UNAVAILABLE_COUNT");
         printPreviewTB.disableSimplifyPage();
+      }
 
       // copy the window close handler
       if (document.documentElement.hasAttribute("onclose"))
         this._closeHandlerPP = document.documentElement.getAttribute("onclose");
       else
         this._closeHandlerPP = null;
       document.documentElement.setAttribute("onclose", "PrintUtils.exitPrintPreview(); return false;");
 
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -5678,16 +5678,33 @@
   "PRINT_PREVIEW_SIMPLIFY_PAGE_OPENED_COUNT": {
     "alert_emails": ["carnold@mozilla.org"],
     "bug_numbers": [1275570],
     "expires_in_version": "56",
     "kind": "count",
     "releaseChannelCollection": "opt-out",
     "description": "A counter incremented every time the browser enters simplified mode on print preview."
   },
+  "PRINT_PREVIEW_SIMPLIFY_PAGE_UNAVAILABLE_COUNT": {
+     "alert_emails": ["carnold@mozilla.org"],
+     "bug_numbers": [1287587],
+     "expires_in_version": "56",
+     "kind": "count",
+     "releaseChannelCollection": "opt-out",
+     "description": "A counter incremented every time the simplified mode is unavailable on print preview."
+   },
+  "PRINT_COUNT": {
+     "alert_emails": ["carnold@mozilla.org"],
+     "bug_numbers": [1287587],
+     "expires_in_version": "56",
+     "kind": "count",
+     "keyed": true,
+     "releaseChannelCollection": "opt-out",
+     "description": "A counter incremented every time the user prints a document."
+   },
   "DEVTOOLS_DEBUGGER_DISPLAY_SOURCE_LOCAL_MS": {
     "expires_in_version": "never",
     "kind": "exponential",
     "high": 10000,
     "n_buckets": 1000,
     "description": "The time (in milliseconds) that it took to display a selected source to the user."
   },
   "DEVTOOLS_DEBUGGER_DISPLAY_SOURCE_REMOTE_MS": {
--- a/toolkit/content/browser-content.js
+++ b/toolkit/content/browser-content.js
@@ -641,16 +641,27 @@ var Printing = {
     if (printSettings && simplifiedMode) {
       printSettings.docURL = contentWindow.document.baseURI;
     }
 
     try {
       let print = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
                                .getInterface(Ci.nsIWebBrowserPrint);
       print.print(printSettings, null);
+
+      let histogram = Services.telemetry.getKeyedHistogramById("PRINT_COUNT");
+      if (print.doingPrintPreview) {
+        if (simplifiedMode) {
+          histogram.add("SIMPLIFIED");
+        } else {
+          histogram.add("WITH_PREVIEW");
+        }
+      } else {
+        histogram.add("WITHOUT_PREVIEW");
+      }
     } catch(e) {
       // Pressing cancel is expressed as an NS_ERROR_ABORT return value,
       // causing an exception to be thrown which we catch here.
       if (e.result != Cr.NS_ERROR_ABORT) {
         Cu.reportError(`In Printing:Print:Done handler, got unexpected rv
                         ${e.result}.`);
         sendAsyncMessage("Printing:Error", {
           isPrinting: true,