Bug 1643402: add telemetry probe that collects information on all pdf fallback errors. r=bdahl

Differential Revision: https://phabricator.services.mozilla.com/D78350
This commit is contained in:
Emma Malysz 2020-06-10 02:42:47 +00:00
parent b341f73995
commit 082a5e072a
3 changed files with 28 additions and 2 deletions

View File

@ -24,13 +24,19 @@ var PdfJsTelemetry = {
onViewerIsUsed() {
Services.telemetry.scalarAdd("pdf.viewer.used", 1);
},
onFallback(featureId) {
onFallbackShown(featureId) {
Services.telemetry.scalarAdd("pdf.viewer.fallback_shown", 1);
let histogram = Services.telemetry.getHistogramById(
"PDF_VIEWER_FALLBACK_REASON"
);
histogram.add(featureId ?? "unknown");
},
onFallbackError(featureId) {
let histogram = Services.telemetry.getHistogramById(
"PDF_VIEWER_FALLBACK_ERROR"
);
histogram.add(featureId ?? "unknown");
},
onDocumentSize(size) {
let histogram = Services.telemetry.getHistogramById(
"PDF_VIEWER_DOCUMENT_SIZE_KB"

View File

@ -275,6 +275,7 @@ class ChromeActions {
firstPageInfo: false,
streamTypesUsed: {},
fontTypesUsed: {},
fallbackErrorsReported: {},
};
}
@ -486,6 +487,14 @@ class ChromeActions {
case "print":
PdfJsTelemetry.onPrint();
break;
case "unsupportedFeature":
if (!this.telemetryState.fallbackErrorsReported[probeInfo.featureId]) {
PdfJsTelemetry.onFallbackError(probeInfo.featureId);
this.telemetryState.fallbackErrorsReported[
probeInfo.featureId
] = true;
}
break;
}
}
@ -504,7 +513,7 @@ class ChromeActions {
} else {
message = getLocalizedString(strings, "unsupported_feature");
}
PdfJsTelemetry.onFallback(featureId);
PdfJsTelemetry.onFallbackShown(featureId);
// Request the display of a notification warning in the associated window
// when the renderer isn't sure a pdf displayed correctly.

View File

@ -9289,6 +9289,17 @@
"labels": ["unknown", "forms", "javaScript", "smask", "shadingPattern", "font", "errorTilingPattern", "errorExtGState", "errorXObject", "errorFontLoadType3", "errorFontState", "errorFontMissing", "errorFontTranslate", "errorColorSpace", "errorOperatorList", "errorFontToUnicode", "errorFontLoadNative", "errorFontGetPath"],
"description": "The reason the fallback bar was shown."
},
"PDF_VIEWER_FALLBACK_ERROR": {
"record_in_processes": ["main", "content"],
"products": ["firefox"],
"expires_in_version": "84",
"alert_emails": ["bdahl@mozilla.com"],
"releaseChannelCollection": "opt-out",
"bug_numbers": [1643402],
"kind": "categorical",
"labels": ["unknown", "forms", "javaScript", "smask", "shadingPattern", "font", "errorTilingPattern", "errorExtGState", "errorXObject", "errorFontLoadType3", "errorFontState", "errorFontMissing", "errorFontTranslate", "errorColorSpace", "errorOperatorList", "errorFontToUnicode", "errorFontLoadNative", "errorFontGetPath"],
"description": "All errors that could trigger the fallback bar, even after the bar is shown."
},
"PLUGINS_NOTIFICATION_SHOWN": {
"record_in_processes": ["main", "content"],
"products": ["firefox", "fennec", "geckoview"],