Merge pull request #29117 from overleaf/jpa-clsi-logging

[clsi] log high level details for large clsi-cache requests

GitOrigin-RevId: e368d745554c925a665f8794514cc8bfed78b7b3
This commit is contained in:
Eric Mc Sween
2025-10-16 08:06:32 +00:00
committed by Copybot
parent 3e57877583
commit 4d39899e7b
+25 -5
View File
@@ -62,10 +62,8 @@ function notifyCLSICacheAboutBuild({
* @param {[{path: string}]} files
*/
const enqueue = files => {
Metrics.count('clsi_cache_enqueue_files', files.length)
fetchNothing(`${url}/enqueue`, {
method: 'POST',
json: {
const body = Buffer.from(
JSON.stringify({
projectId,
userId,
buildId,
@@ -75,7 +73,29 @@ function notifyCLSICacheAboutBuild({
clsiServerId: Settings.apis.clsi.clsiServerId,
compileGroup,
options,
},
})
)
const bodySize = body.byteLength
if (bodySize > 10_000_000) {
const outputPDF = files.find(f => f.path === 'output.pdf')
logger.warn(
{
projectId,
userId,
bodySize,
nFiles: files.length,
outputPDFSize:
outputPDF && Buffer.from(JSON.stringify(outputPDF)).byteLength,
nPDFCachingRanges: outputPDF?.ranges?.length,
},
'large clsi-cache request'
)
}
Metrics.count('clsi_cache_enqueue_files', files.length)
fetchNothing(`${url}/enqueue`, {
method: 'POST',
body,
headers: { 'Content-Type': 'application/json' },
signal: AbortSignal.timeout(15_000),
}).catch(err => {
logger.warn(