mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-25 10:10:08 +02:00
[web] drop rate of compile-result-backend events to 1%
GitOrigin-RevId: af3e4b56812f014ad7c40d1a98ee6db16798890b
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user