Merge pull request #28959 from overleaf/bg-exclude-health-checks-from-performance-logs

exclude health checks from performance logs

GitOrigin-RevId: 88db63e00b32b2b015ee25c7d555546ed7d9a95b
This commit is contained in:
Brian Gough
2025-10-10 09:08:35 +01:00
committed by Copybot
parent 7b6565c98f
commit da3f366643
5 changed files with 181 additions and 17 deletions

View File

@@ -24,6 +24,7 @@ const {
downloadOutputDotSynctexFromCompileCache,
} = require('./CLSICacheHandler')
const StatsManager = require('./StatsManager')
const { enableLatexMkMetrics } = require('./LatexMetrics')
const { callbackifyMultiResult } = require('@overleaf/promise-utils')
const COMPILE_TIME_BUCKETS = [
@@ -193,23 +194,14 @@ async function doCompile(request, stats, timings) {
const compileName = getCompileName(request.project_id, request.user_id)
// Record latexmk -time stats for a subset of users
const recordPerformanceMetrics =
request.user_id != null &&
Settings.performanceLogSamplingPercentage > 0 &&
StatsManager.sampleByHash(
request.user_id,
Settings.performanceLogSamplingPercentage
)
const recordPerformanceMetrics = StatsManager.sampleRequest(
request,
Settings.performanceLogSamplingPercentage
)
// For selected users, define a `latexmk` property on the stats object
// to collect latexmk -time stats.
if (recordPerformanceMetrics) {
// To prevent any changes to the existing compile responses being sent
// to web, exclude latexmk stats from being exported by marking them
// non-enumerable. This prevents them being serialised by JSON.stringify().
Object.defineProperty(stats, 'latexmk', {
value: {},
enumerable: false,
})
enableLatexMkMetrics(stats)
}
try {