mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01: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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user