From 2b302a8accd257735f3b92f80e50c39661fc9ad3 Mon Sep 17 00:00:00 2001 From: Antoine Clausse Date: Mon, 6 May 2024 09:44:49 +0200 Subject: [PATCH] Reintroduce compile sampling for analysis (#18217) * Revert "Merge pull request #14143 from overleaf/jlm-unsampled-compiles" This reverts commit 2457977d61756be52db506d7c84531b22a26abe0, reversing changes made to 3c452b3943c453707aac90d38e7b5b2ea9df0df4. * Re-add export of `getPercentile` in SplitTestHandler.js Was previously removed in https://github.com/overleaf/internal/commit/aa8c0aadec90b23ead60a4baeb33d6c3c6a2e536 GitOrigin-RevId: 42c48829e7246a6bdb9dbb2d075638c1eafdf2f0 --- .../web/app/src/Features/Compile/CompileController.js | 9 ++++++++- .../web/app/src/Features/SplitTests/SplitTestHandler.js | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/services/web/app/src/Features/Compile/CompileController.js b/services/web/app/src/Features/Compile/CompileController.js index 8515e430bb..dbab01a8f4 100644 --- a/services/web/app/src/Features/Compile/CompileController.js +++ b/services/web/app/src/Features/Compile/CompileController.js @@ -160,7 +160,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. diff --git a/services/web/app/src/Features/SplitTests/SplitTestHandler.js b/services/web/app/src/Features/SplitTests/SplitTestHandler.js index 1a5203f73a..963c8f970b 100644 --- a/services/web/app/src/Features/SplitTests/SplitTestHandler.js +++ b/services/web/app/src/Features/SplitTests/SplitTestHandler.js @@ -499,6 +499,7 @@ async function _getSplitTest(name) { } module.exports = { + getPercentile, getAssignment: callbackify(getAssignment), getAssignmentForMongoUser: callbackify(getAssignmentForMongoUser), getAssignmentForUser: callbackify(getAssignmentForUser),