Bug 1306624 - Add telemetry probes to count how many times a user requests to print a document. r=mconley, data-review=liuche

This commit is contained in:
Thauã Silveira 2016-10-05 06:42:00 +02:00
Родитель b813bcffe5
Коммит f2083da255
2 изменённых файлов: 24 добавлений и 4 удалений

Просмотреть файл

@ -6289,6 +6289,15 @@
"releaseChannelCollection": "opt-out",
"description": "A counter incremented every time the simplified mode is unavailable on print preview."
},
"PRINT_DIALOG_OPENED_COUNT": {
"alert_emails": ["carnold@mozilla.org"],
"bug_numbers": [1306624],
"expires_in_version": "56",
"kind": "count",
"keyed": true,
"releaseChannelCollection": "opt-out",
"description": "A counter incremented every time the user opens print dialog."
},
"PRINT_COUNT": {
"alert_emails": ["carnold@mozilla.org"],
"bug_numbers": [1287587],

Просмотреть файл

@ -647,17 +647,23 @@ var Printing = {
try {
let print = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebBrowserPrint);
if (print.doingPrintPreview) {
this.logKeyedTelemetry("PRINT_DIALOG_OPENED_COUNT", "FROM_PREVIEW");
} else {
this.logKeyedTelemetry("PRINT_DIALOG_OPENED_COUNT", "FROM_PAGE");
}
print.print(printSettings, null);
let histogram = Services.telemetry.getKeyedHistogramById("PRINT_COUNT");
if (print.doingPrintPreview) {
if (simplifiedMode) {
histogram.add("SIMPLIFIED");
this.logKeyedTelemetry("PRINT_COUNT", "SIMPLIFIED");
} else {
histogram.add("WITH_PREVIEW");
this.logKeyedTelemetry("PRINT_COUNT", "WITH_PREVIEW");
}
} else {
histogram.add("WITHOUT_PREVIEW");
this.logKeyedTelemetry("PRINT_COUNT", "WITHOUT_PREVIEW");
}
} catch (e) {
// Pressing cancel is expressed as an NS_ERROR_ABORT return value,
@ -683,6 +689,11 @@ var Printing = {
}
},
logKeyedTelemetry(id, key) {
let histogram = Services.telemetry.getKeyedHistogramById(id);
histogram.add(key);
},
updatePageCount() {
let numPages = docShell.printPreview.printPreviewNumPages;
sendAsyncMessage("Printing:Preview:UpdatePageCount", {