logger: Add a sampling rate of 10

This rate was decided in T88173

Bug: T88167
Change-Id: I22776582c271fa83ba5b98d38dd01775ebbfcef1
This commit is contained in:
Prateek Saxena 2015-03-26 06:58:29 +05:30
parent c39bbc8a68
commit f4dbd455c6

View file

@ -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();
}