Skip to content

Commit

Permalink
Add histogram for printer status reasons
Browse files Browse the repository at this point in the history
This changes adds metrics to record the printer status reasons returned
by printer status queries. This metric coincides with the addition of
printer availability icons to the Print Preview destination dropdown
(go/printer-status-design-doc).

Bug: 1059607
Change-Id: Ica85163a3dcc0ecdbe34370f14f998512aaa3a4e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2347313
Reviewed-by: Zentaro Kavanagh <zentaro@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Bailey Berro <baileyberro@chromium.org>
Reviewed-by: Ilya Sherman <isherman@chromium.org>
Commit-Queue: Gavin Williams <gavinwill@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797789}
  • Loading branch information
Gavin Williams authored and Commit Bot committed Aug 13, 2020
1 parent 79c402e commit 87f0bb7
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 2 deletions.
8 changes: 8 additions & 0 deletions chrome/browser/chromeos/printing/cups_printers_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,14 @@ class CupsPrintersManagerImpl
break;
}
case PrinterQueryResult::SUCCESS: {
// Record results from PrinterStatus before converting to
// CupsPrinterStatus because the PrinterStatus enum contains more reason
// buckets.
for (const auto& reason : printer_status.reasons) {
base::UmaHistogramEnumeration("Printing.CUPS.PrinterStatusReasons",
reason.reason);
}

// Convert printing::PrinterStatus to printing::CupsPrinterStatus
CupsPrinterStatus cups_printers_status =
PrinterStatusToCupsPrinterStatus(printer_id, printer_status);
Expand Down
7 changes: 5 additions & 2 deletions printing/printer_status.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ namespace printing {
// printer-state-reasons, and printer-state-message.
struct PRINTING_EXPORT PrinterStatus {
struct PrinterReason {
// Standardized reasons from RFC2911.
// This enum is used to record UMA histogram values and should not be
// reordered. Please keep in sync with PrinterStatusReasons in
// src/tools/metrics/histograms/enums.xml.
enum class Reason {
UNKNOWN_REASON = 0,
NONE = 1,
Expand Down Expand Up @@ -53,7 +55,8 @@ struct PRINTING_EXPORT PrinterStatus {
OPC_LIFE_OVER = 30,
DEVELOPER_LOW = 31,
DEVELOPER_EMPTY = 32,
INTERPRETER_RESOURCE_UNAVAILABLE = 33
INTERPRETER_RESOURCE_UNAVAILABLE = 33,
kMaxValue = INTERPRETER_RESOURCE_UNAVAILABLE
};

// Severity of the state-reason.
Expand Down
37 changes: 37 additions & 0 deletions tools/metrics/histograms/enums.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57324,6 +57324,43 @@ Called by update_net_trust_anchors.py.-->
<int value="4" label="Printer was setup via Extensions API"/>
</enum>

<enum name="PrinterStatusReasons">
<int value="0" label="UNKNOWN_REASON"/>
<int value="1" label="NONE"/>
<int value="2" label="MEDIA_NEEDED"/>
<int value="3" label="MEDIA_JAM"/>
<int value="4" label="MOVING_TO_PAUSED"/>
<int value="5" label="PAUSED"/>
<int value="6" label="SHUTDOWN"/>
<int value="7" label="CONNECTING_TO_DEVICE"/>
<int value="8" label="TIMED_OUT"/>
<int value="9" label="STOPPING"/>
<int value="10" label="STOPPED_PARTLY"/>
<int value="11" label="TONER_LOW"/>
<int value="12" label="TONER_EMPTY"/>
<int value="13" label="SPOOL_AREA_FULL"/>
<int value="14" label="COVER_OPEN"/>
<int value="15" label="INTERLOCK_OPEN"/>
<int value="16" label="DOOR_OPEN"/>
<int value="17" label="INPUT_TRAY_MISSING"/>
<int value="18" label="MEDIA_LOW"/>
<int value="19" label="MEDIA_EMPTY"/>
<int value="20" label="OUTPUT_TRAY_MISSING"/>
<int value="21" label="OUTPUT_AREA_ALMOST_FULL"/>
<int value="22" label="OUTPUT_AREA_FULL"/>
<int value="23" label="MARKER_SUPPLY_LOW"/>
<int value="24" label="MARKER_SUPPLY_EMPTY"/>
<int value="25" label="MARKER_WASTE_ALMOST_FULL"/>
<int value="26" label="MARKER_WASTE_FULL"/>
<int value="27" label="FUSER_OVER_TEMP"/>
<int value="28" label="FUSER_UNDER_TEMP"/>
<int value="29" label="OPC_NEAR_EOL"/>
<int value="30" label="OPC_LIFE_OVER"/>
<int value="31" label="DEVELOPER_LOW"/>
<int value="32" label="DEVELOPER_EMPTY"/>
<int value="33" label="INTERPRETER_RESOURCE_UNAVAILABLE"/>
</enum>

<enum name="PrintJobResult">
<int value="0" label="Unknown"/>
<int value="1" label="Successful Finish"/>
Expand Down
12 changes: 12 additions & 0 deletions tools/metrics/histograms/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139380,6 +139380,18 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
</summary>
</histogram>

<histogram name="Printing.CUPS.PrinterStatusReasons"
enum="PrinterStatusReasons" expires_after="2021-08-10">
<owner>gavinwill@chromium.org</owner>
<owner>cros-peripherals@google.com</owner>
<summary>
Records the status reasons returned by a local printer from a printer status
query. Each returned printer status request can contain multiple status
reasons so summing these buckets will overcount the total # of status
queries.
</summary>
</histogram>

<histogram name="Printing.CUPS.PrintJobDatabaseEntries" units="entries"
expires_after="2020-09-11">
<owner>nikitapodguzov@chromium.org</owner>
Expand Down

0 comments on commit 87f0bb7

Please sign in to comment.