mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #4108 from overleaf/jpa-lean-pdf-caching-metrics
[frontend] PdfJsMetrics: submit a subset of data points, flatten nested GitOrigin-RevId: a98ede58f5823020a4c78f46b9800369185f1336
This commit is contained in:
parent
0015002e53
commit
5988e03dac
1 changed files with 24 additions and 2 deletions
|
@ -51,11 +51,33 @@ export function trackPdfDownload(response, compileTimeClientE2E) {
|
|||
}
|
||||
|
||||
function submitCompileMetrics(metrics) {
|
||||
let {
|
||||
latencyFetch,
|
||||
latencyRender,
|
||||
compileTimeClientE2E,
|
||||
stats,
|
||||
timings,
|
||||
} = metrics
|
||||
stats = stats || {}
|
||||
timings = timings || {}
|
||||
const leanMetrics = {
|
||||
latencyFetch,
|
||||
latencyRender,
|
||||
pdfSize: stats['pdf-size'],
|
||||
compileTimeClientE2E,
|
||||
compileTimeServerE2E: timings.compileE2E,
|
||||
}
|
||||
sl_console.log('/event/compile-metrics', JSON.stringify(metrics))
|
||||
sendMBSampled('compile-metrics', metrics, SAMPLING_RATE)
|
||||
sendMBSampled('compile-metrics', leanMetrics, SAMPLING_RATE)
|
||||
}
|
||||
|
||||
function submitPDFBandwidth(metrics) {
|
||||
const metricsFlat = {}
|
||||
Object.entries(metrics).forEach(([section, items]) => {
|
||||
Object.entries(items).forEach(([key, value]) => {
|
||||
metricsFlat[section + '_' + key] = value
|
||||
})
|
||||
})
|
||||
sl_console.log('/event/pdf-bandwidth', JSON.stringify(metrics))
|
||||
sendMBSampled('pdf-bandwidth', metrics, SAMPLING_RATE)
|
||||
sendMBSampled('pdf-bandwidth', metricsFlat, SAMPLING_RATE)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue