Merge pull request #13091 from overleaf/jpa-metric-blg

[web] add metric for blg file usage

GitOrigin-RevId: 5a6bd4185d5f236a56994331cfe3b25c1998d0db
This commit is contained in:
Jakob Ackermann 2023-05-15 14:55:35 +01:00 committed by Copybot
parent 29b951e705
commit 21950fdb30
2 changed files with 18 additions and 0 deletions

View file

@ -24,6 +24,22 @@ const Errors = require('../Errors/Errors')
const VALID_COMPILERS = ['pdflatex', 'latex', 'xelatex', 'lualatex']
function collectMetricsOnBlgFiles(outputFiles) {
let topLevel = 0
let nested = 0
for (const outputFile of outputFiles) {
if (outputFile.type === 'blg') {
if (outputFile.path.includes('/')) {
nested++
} else {
topLevel++
}
}
}
Metrics.count('blg_output_file', topLevel, 1, { path: 'top-level' })
Metrics.count('blg_output_file', nested, 1, { path: 'nested' })
}
const ClsiManager = {
sendRequest(projectId, userId, options, callback) {
if (options == null) {
@ -265,6 +281,7 @@ const ClsiManager = {
projectId,
response && response.compile && response.compile.outputFiles
)
collectMetricsOnBlgFiles(outputFiles)
const compile = (response && response.compile) || {}
const status = compile.status
const stats = compile.stats

View file

@ -33,6 +33,7 @@ describe('ClsiManager', function () {
}
},
inc: sinon.stub(),
count: sinon.stub(),
}
this.ClsiManager = SandboxedModule.require(modulePath, {
requires: {