Skip to content

Commit de7cfed

Browse files
Merge pull request #14260 from Snuffleupagus/telemetry-pageInfo-once
Report "pageInfo" telemetry once, rather than for each rendered page
2 parents 138ebb0 + 8eed0b9 commit de7cfed

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

web/app.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,12 @@ const PDFViewerApplication = {
13721372
this._initializeAutoPrint(pdfDocument, openActionPromise);
13731373
});
13741374

1375-
onePageRendered.then(() => {
1375+
onePageRendered.then(data => {
1376+
this.externalServices.reportTelemetry({
1377+
type: "pageInfo",
1378+
timestamp: data.timestamp,
1379+
});
1380+
13761381
pdfDocument.getOutline().then(outline => {
13771382
if (pdfDocument !== this.pdfDocument) {
13781383
return; // The document was closed while the outline resolved.
@@ -2315,7 +2320,7 @@ function webViewerResetPermissions() {
23152320
appConfig.viewerContainer.classList.remove(ENABLE_PERMISSIONS_CLASS);
23162321
}
23172322

2318-
function webViewerPageRendered({ pageNumber, timestamp, error }) {
2323+
function webViewerPageRendered({ pageNumber, error }) {
23192324
// If the page is still visible when it has finished rendering,
23202325
// ensure that the page number input loading indicator is hidden.
23212326
if (pageNumber === PDFViewerApplication.page) {
@@ -2341,10 +2346,6 @@ function webViewerPageRendered({ pageNumber, timestamp, error }) {
23412346
});
23422347
}
23432348

2344-
PDFViewerApplication.externalServices.reportTelemetry({
2345-
type: "pageInfo",
2346-
timestamp,
2347-
});
23482349
// It is a good time to report stream and font types.
23492350
PDFViewerApplication.pdfDocument.getStats().then(function (stats) {
23502351
PDFViewerApplication.externalServices.reportTelemetry({

web/base_viewer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ class BaseViewer {
554554
if (evt.cssTransform || this._onePageRenderedCapability.settled) {
555555
return;
556556
}
557-
this._onePageRenderedCapability.resolve();
557+
this._onePageRenderedCapability.resolve({ timestamp: evt.timestamp });
558558

559559
this.eventBus._off("pagerendered", this._onAfterDraw);
560560
this._onAfterDraw = null;

0 commit comments

Comments
 (0)