Merge pull request #8505 from overleaf/jpa-compile-result-full

[web] collect compile-result for ALL compiles

GitOrigin-RevId: 5ba29fb352bc29d14c22e7e80fa556148d862137
This commit is contained in:
Jakob Ackermann 2022-06-22 11:58:09 +01:00 committed by Copybot
parent b9b61d4f20
commit 51c870c285
4 changed files with 25 additions and 24 deletions

View file

@ -88,9 +88,12 @@ module.exports = CompileController = {
if (pdfDownloadDomain && outputUrlPrefix) {
pdfDownloadDomain += outputUrlPrefix
}
let showFasterCompilesFeedbackUI = false
if (limits?.emitCompileResultEvent) {
showFasterCompilesFeedbackUI = true
if (limits) {
// For a compile request to be sent to clsi we need limits.
// If we get here without having the limits object populated, it is
// a reasonable assumption to make that nothing was compiled.
// We need to know the limits in order to make use of the events.
AnalyticsManager.recordEventForSession(
req.session,
'compile-result-backend',
@ -113,7 +116,7 @@ module.exports = CompileController = {
stats,
timings,
pdfDownloadDomain,
showFasterCompilesFeedbackUI,
showFasterCompilesFeedbackUI: limits?.showFasterCompilesFeedbackUI,
})
}
)

View file

@ -171,10 +171,11 @@ module.exports = CompileManager = {
CompileManager._getCompileBackendClassDetails(
owner,
limits.compileGroup,
(err, { compileBackendClass, emitCompileResultEvent }) => {
(err, { compileBackendClass, showFasterCompilesFeedbackUI }) => {
if (err) return callback(err)
limits.compileBackendClass = compileBackendClass
limits.emitCompileResultEvent = emitCompileResultEvent
limits.showFasterCompilesFeedbackUI =
showFasterCompilesFeedbackUI
callback(null, limits)
}
)
@ -250,7 +251,7 @@ module.exports = CompileManager = {
if (compileGroup === 'standard') {
return callback(null, {
compileBackendClass: defaultBackendClass,
emitCompileResultEvent: false,
showFasterCompilesFeedbackUI: false,
})
}
SplitTestHandler.getAssignmentForMongoUser(
@ -263,7 +264,7 @@ module.exports = CompileManager = {
callback(null, {
compileBackendClass:
variant === 'default' ? defaultBackendClass : variant,
emitCompileResultEvent: activeForUser,
showFasterCompilesFeedbackUI: activeForUser,
})
}
)

View file

@ -114,7 +114,6 @@ describe('CompileController', function () {
},
],
pdfDownloadDomain: 'https://compiles.overleaf.test',
showFasterCompilesFeedbackUI: false,
})
)
})
@ -156,7 +155,6 @@ describe('CompileController', function () {
},
],
pdfDownloadDomain: 'https://compiles.overleaf.test/zone/b',
showFasterCompilesFeedbackUI: false,
})
)
})
@ -194,7 +192,6 @@ describe('CompileController', function () {
JSON.stringify({
status: this.status,
outputFiles: this.outputFiles,
showFasterCompilesFeedbackUI: false,
})
)
})

View file

@ -221,7 +221,7 @@ describe('CompileManager', function () {
compileGroup: this.group,
compileBackendClass: 'e2',
ownerAnalyticsId: 'abc',
emitCompileResultEvent: false,
showFasterCompilesFeedbackUI: false,
})
.should.equal(true)
})
@ -245,13 +245,13 @@ describe('CompileManager', function () {
beforeEach(function () {
this.features.compileGroup = 'standard'
})
it('should return the default class and disable event', function (done) {
it('should return the default class and disable ui', function (done) {
this.CompileManager.getProjectCompileLimits(
this.project_id,
(err, { compileBackendClass, emitCompileResultEvent }) => {
(err, { compileBackendClass, showFasterCompilesFeedbackUI }) => {
if (err) return done(err)
expect(compileBackendClass).to.equal('e2')
expect(emitCompileResultEvent).to.equal(false)
expect(showFasterCompilesFeedbackUI).to.equal(false)
done()
}
)
@ -270,13 +270,13 @@ describe('CompileManager', function () {
})
})
it('should return the default class and disable event', function (done) {
it('should return the default class and disable ui', function (done) {
this.CompileManager.getProjectCompileLimits(
this.project_id,
(err, { compileBackendClass, emitCompileResultEvent }) => {
(err, { compileBackendClass, showFasterCompilesFeedbackUI }) => {
if (err) return done(err)
expect(compileBackendClass).to.equal('e2')
expect(emitCompileResultEvent).to.equal(false)
expect(showFasterCompilesFeedbackUI).to.equal(false)
done()
}
)
@ -291,13 +291,13 @@ describe('CompileManager', function () {
variant: 'default',
})
})
it('should return the default class and enable event', function (done) {
it('should return the default class and enable ui', function (done) {
this.CompileManager.getProjectCompileLimits(
this.project_id,
(err, { compileBackendClass, emitCompileResultEvent }) => {
(err, { compileBackendClass, showFasterCompilesFeedbackUI }) => {
if (err) return done(err)
expect(compileBackendClass).to.equal('e2')
expect(emitCompileResultEvent).to.equal(true)
expect(showFasterCompilesFeedbackUI).to.equal(true)
done()
}
)
@ -311,13 +311,13 @@ describe('CompileManager', function () {
variant: 'c2d',
})
})
it('should return the c2d class and enable event', function (done) {
it('should return the c2d class and enable ui', function (done) {
this.CompileManager.getProjectCompileLimits(
this.project_id,
(err, { compileBackendClass, emitCompileResultEvent }) => {
(err, { compileBackendClass, showFasterCompilesFeedbackUI }) => {
if (err) return done(err)
expect(compileBackendClass).to.equal('c2d')
expect(emitCompileResultEvent).to.equal(true)
expect(showFasterCompilesFeedbackUI).to.equal(true)
done()
}
)