mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-27 17:00:37 +00:00
logger: Add a sampling rate of 10
This rate was decided in T88173 Bug: T88167 Change-Id: I22776582c271fa83ba5b98d38dd01775ebbfcef1
This commit is contained in:
parent
c39bbc8a68
commit
f4dbd455c6
|
@ -6,6 +6,12 @@
|
|||
*/
|
||||
var logger = {};
|
||||
|
||||
/**
|
||||
* Sampling rate at which events are logged
|
||||
* @property samplingRate
|
||||
*/
|
||||
logger.samplingRate = 10;
|
||||
|
||||
/**
|
||||
* Get action based on click event
|
||||
*
|
||||
|
@ -35,7 +41,10 @@
|
|||
* @return {jQuery.Promise}
|
||||
*/
|
||||
logger.log = function ( event ) {
|
||||
if ( mw.eventLog === undefined ) {
|
||||
if (
|
||||
mw.eventLog === undefined ||
|
||||
Math.floor( Math.random() * logger.samplingRate ) !== 0
|
||||
) {
|
||||
return $.Deferred().resolve();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue