mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
[web] drop rate of compile-result-backend events to 1%
GitOrigin-RevId: af3e4b56812f014ad7c40d1a98ee6db16798890b
This commit is contained in:
parent
19dd2f67e2
commit
7493be028d
2 changed files with 11 additions and 7 deletions
|
@ -141,7 +141,14 @@ module.exports = CompileController = {
|
|||
pdfDownloadDomain += outputUrlPrefix
|
||||
}
|
||||
|
||||
if (limits) {
|
||||
if (
|
||||
limits &&
|
||||
SplitTestHandler.getPercentile(
|
||||
AnalyticsManager.getIdsFromSession(req.session).analyticsId,
|
||||
'compile-result-backend',
|
||||
'release'
|
||||
) === 1
|
||||
) {
|
||||
// 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.
|
||||
|
|
|
@ -263,11 +263,7 @@ async function _getAssignmentMetadata(analyticsId, user, splitTest) {
|
|||
}
|
||||
}
|
||||
const userId = user?._id.toString()
|
||||
const percentile = _getPercentile(
|
||||
analyticsId || userId,
|
||||
splitTest.name,
|
||||
phase
|
||||
)
|
||||
const percentile = getPercentile(analyticsId || userId, splitTest.name, phase)
|
||||
const selectedVariantName = _getVariantFromPercentile(
|
||||
currentVersion.variants,
|
||||
percentile
|
||||
|
@ -280,7 +276,7 @@ async function _getAssignmentMetadata(analyticsId, user, splitTest) {
|
|||
}
|
||||
}
|
||||
|
||||
function _getPercentile(analyticsId, splitTestName, splitTestPhase) {
|
||||
function getPercentile(analyticsId, splitTestName, splitTestPhase) {
|
||||
const hash = crypto
|
||||
.createHash('md5')
|
||||
.update(analyticsId + splitTestName + splitTestPhase)
|
||||
|
@ -408,6 +404,7 @@ async function _loadSplitTestInfoInLocals(locals, splitTestName) {
|
|||
}
|
||||
|
||||
module.exports = {
|
||||
getPercentile,
|
||||
getAssignment: callbackify(getAssignment),
|
||||
getAssignmentForMongoUser: callbackify(getAssignmentForMongoUser),
|
||||
getAssignmentForUser: callbackify(getAssignmentForUser),
|
||||
|
|
Loading…
Reference in a new issue