From 4d39899e7bab599d76beba1c1e1b422b84f9598a Mon Sep 17 00:00:00 2001 From: Eric Mc Sween <5454374+emcsween@users.noreply.github.com> Date: Wed, 15 Oct 2025 08:40:41 -0400 Subject: [PATCH] Merge pull request #29117 from overleaf/jpa-clsi-logging [clsi] log high level details for large clsi-cache requests GitOrigin-RevId: e368d745554c925a665f8794514cc8bfed78b7b3 --- services/clsi/app/js/CLSICacheHandler.js | 30 ++++++++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/services/clsi/app/js/CLSICacheHandler.js b/services/clsi/app/js/CLSICacheHandler.js index 26acd221f9..9ba2d6f499 100644 --- a/services/clsi/app/js/CLSICacheHandler.js +++ b/services/clsi/app/js/CLSICacheHandler.js @@ -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(