Bug 1646093. Modify printing telemetry to add a PDF-catch-all for possible unknown PDF printers. r=bobowen
authorJonathan Watt <jwatt@jwatt.org>
Wed, 17 Jun 2020 00:09:05 +0000
changeset 535986 3703059ed8f0b814e2164b93612c514bcd1dc02c
parent 535985 c495c526de609f80cf8664581086ad0ec87ec39d
child 535987 024c23596ff6a42d276fc05462c77eea60f7ae27
push id119197
push userjwatt@jwatt.org
push dateWed, 17 Jun 2020 00:09:55 +0000
treeherderautoland@3703059ed8f0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbobowen
bugs1646093
milestone79.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 1646093. Modify printing telemetry to add a PDF-catch-all for possible unknown PDF printers. r=bobowen Differential Revision: https://phabricator.services.mozilla.com/D79853
toolkit/components/telemetry/Scalars.yaml
widget/windows/nsDeviceContextSpecWin.cpp
--- a/toolkit/components/telemetry/Scalars.yaml
+++ b/toolkit/components/telemetry/Scalars.yaml
@@ -3896,22 +3896,27 @@ printing:
     record_in_processes:
       - 'content'
 
   target_type:
     bug_numbers:
       - 1600623
     description: >
       A counter incremented every time the user prints to a certain target
-      type.  For the most part, the 'unknown' count will be prints to a
-      physical printer, but we can't know for sure since third party drivers
-      could also be print to file drivers.
+      type.  The 'pdf_unknown' count is for printers with names that we don't
+      know about/check for, but that have 'pdf' in their name, and is mainly a
+      sanity check that we're not missing significant counts in 'pdf_file'.
+      For the most part, the 'unknown' count will be prints to a physical
+      printer, but we can't know for sure since third party drivers could also
+      be print to file drivers that we don't otherwise catch in the other
+      counts.  
     keyed: true
     keys:
       - 'pdf_file'
+      - 'pdf_unknown'
       - 'xps_file'
       - 'unknown'
     expires: never
     kind: uint
     notification_emails:
       - jwatt@jwatt.org
     release_channel_collection: opt-out
     products:
--- a/widget/windows/nsDeviceContextSpecWin.cpp
+++ b/widget/windows/nsDeviceContextSpecWin.cpp
@@ -176,18 +176,26 @@ NS_IMETHODIMP nsDeviceContextSpecWin::In
                  printerName,
                  NS_LITERAL_STRING("Universal Document Converter"))) {
     Telemetry::ScalarAdd(Telemetry::ScalarID::PRINTING_TARGET_TYPE,
                          NS_LITERAL_STRING("pdf_file"), 1);
   } else if (printerName.EqualsLiteral("Microsoft XPS Document Writer")) {
     Telemetry::ScalarAdd(Telemetry::ScalarID::PRINTING_TARGET_TYPE,
                          NS_LITERAL_STRING("xps_file"), 1);
   } else {
-    Telemetry::ScalarAdd(Telemetry::ScalarID::PRINTING_TARGET_TYPE,
-                         NS_LITERAL_STRING("unknown"), 1);
+    nsAString::const_iterator start, end;
+    printerName.BeginReading(start);
+    printerName.EndReading(end);
+    if (CaseInsensitiveFindInReadable(NS_LITERAL_STRING("pdf"), start, end)) {
+      Telemetry::ScalarAdd(Telemetry::ScalarID::PRINTING_TARGET_TYPE,
+                           NS_LITERAL_STRING("pdf_unknown"), 1);
+    } else {
+      Telemetry::ScalarAdd(Telemetry::ScalarID::PRINTING_TARGET_TYPE,
+                           NS_LITERAL_STRING("unknown"), 1);
+    }
   }
 
   nsresult rv = NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE;
   if (aPrintSettings) {
 #ifdef MOZ_ENABLE_SKIA_PDF
     nsAutoString printViaPdf;
     Preferences::GetString("print.print_via_pdf_encoder", printViaPdf);
     if (printViaPdf.EqualsLiteral("skia-pdf")) {