Merge pull request #14260 from Snuffleupagus/telemetry-pageInfo-once

Report "pageInfo" telemetry once, rather than for each rendered page
This commit is contained in:
Tim van der Meij 2021-11-13 20:22:58 +01:00 committed by GitHub
commit de7cfed9e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -1372,7 +1372,12 @@ const PDFViewerApplication = {
this._initializeAutoPrint(pdfDocument, openActionPromise); this._initializeAutoPrint(pdfDocument, openActionPromise);
}); });
onePageRendered.then(() => { onePageRendered.then(data => {
this.externalServices.reportTelemetry({
type: "pageInfo",
timestamp: data.timestamp,
});
pdfDocument.getOutline().then(outline => { pdfDocument.getOutline().then(outline => {
if (pdfDocument !== this.pdfDocument) { if (pdfDocument !== this.pdfDocument) {
return; // The document was closed while the outline resolved. return; // The document was closed while the outline resolved.
@ -2315,7 +2320,7 @@ function webViewerResetPermissions() {
appConfig.viewerContainer.classList.remove(ENABLE_PERMISSIONS_CLASS); appConfig.viewerContainer.classList.remove(ENABLE_PERMISSIONS_CLASS);
} }
function webViewerPageRendered({ pageNumber, timestamp, error }) { function webViewerPageRendered({ pageNumber, error }) {
// If the page is still visible when it has finished rendering, // If the page is still visible when it has finished rendering,
// ensure that the page number input loading indicator is hidden. // ensure that the page number input loading indicator is hidden.
if (pageNumber === PDFViewerApplication.page) { if (pageNumber === PDFViewerApplication.page) {
@ -2341,10 +2346,6 @@ function webViewerPageRendered({ pageNumber, timestamp, error }) {
}); });
} }
PDFViewerApplication.externalServices.reportTelemetry({
type: "pageInfo",
timestamp,
});
// It is a good time to report stream and font types. // It is a good time to report stream and font types.
PDFViewerApplication.pdfDocument.getStats().then(function (stats) { PDFViewerApplication.pdfDocument.getStats().then(function (stats) {
PDFViewerApplication.externalServices.reportTelemetry({ PDFViewerApplication.externalServices.reportTelemetry({

View File

@ -554,7 +554,7 @@ class BaseViewer {
if (evt.cssTransform || this._onePageRenderedCapability.settled) { if (evt.cssTransform || this._onePageRenderedCapability.settled) {
return; return;
} }
this._onePageRenderedCapability.resolve(); this._onePageRenderedCapability.resolve({ timestamp: evt.timestamp });
this.eventBus._off("pagerendered", this._onAfterDraw); this.eventBus._off("pagerendered", this._onAfterDraw);
this._onAfterDraw = null; this._onAfterDraw = null;