mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #4107 from overleaf/jpa-compile-time-client-e2e
[frontend] PdfController: track the e2e compile time seen by the client GitOrigin-RevId: 1d7c8b815735fd3c0ad9a32284c37c621798fbd3
This commit is contained in:
parent
13b7cc8bcb
commit
0015002e53
2 changed files with 8 additions and 4 deletions
|
@ -341,7 +341,7 @@ App.controller(
|
|||
|
||||
function noop() {}
|
||||
|
||||
function parseCompileResponse(response) {
|
||||
function parseCompileResponse(response, compileTimeClientE2E) {
|
||||
// keep last url
|
||||
const lastPdfUrl = $scope.pdf.url
|
||||
const { pdfDownloadDomain } = response
|
||||
|
@ -413,7 +413,8 @@ App.controller(
|
|||
|
||||
if (getMeta('ol-trackPdfDownload')) {
|
||||
const { firstRenderDone, updateConsumedBandwidth } = trackPdfDownload(
|
||||
response
|
||||
response,
|
||||
compileTimeClientE2E
|
||||
)
|
||||
$scope.pdf.firstRenderDone = firstRenderDone
|
||||
$scope.pdf.updateConsumedBandwidth = updateConsumedBandwidth
|
||||
|
@ -817,12 +818,14 @@ App.controller(
|
|||
|
||||
options.rootDocOverride_id = getRootDocOverrideId()
|
||||
|
||||
const t0 = performance.now()
|
||||
sendCompileRequest(options)
|
||||
.then(function (response) {
|
||||
const { data } = response
|
||||
const compileTimeClientE2E = performance.now() - t0
|
||||
$scope.pdf.view = 'pdf'
|
||||
$scope.pdf.compiling = false
|
||||
parseCompileResponse(data)
|
||||
parseCompileResponse(data, compileTimeClientE2E)
|
||||
})
|
||||
.catch(function (response) {
|
||||
const { status } = response
|
||||
|
|
|
@ -9,7 +9,7 @@ const pdfJsMetrics = {
|
|||
|
||||
const SAMPLING_RATE = 0.01
|
||||
|
||||
export function trackPdfDownload(response) {
|
||||
export function trackPdfDownload(response, compileTimeClientE2E) {
|
||||
const { serviceWorkerMetrics, stats, timings } = response
|
||||
|
||||
const t0 = performance.now()
|
||||
|
@ -36,6 +36,7 @@ export function trackPdfDownload(response) {
|
|||
submitCompileMetrics({
|
||||
latencyFetch,
|
||||
latencyRender,
|
||||
compileTimeClientE2E,
|
||||
stats,
|
||||
timings,
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue