Skip to content

Instantly share code, notes, and snippets.

@jdlrobson
Created July 7, 2017 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdlrobson/999ad762eead45fd27a4d6e29aebe9f8 to your computer and use it in GitHub Desktop.
Save jdlrobson/999ad762eead45fd27a4d6e29aebe9f8 to your computer and use it in GitHub Desktop.
bucketme
weightedBoolean = function ( name, trueWeight, token ) {
return mw.experiments.getBucket( {
enabled: true,
name: name,
buckets: {
'true': trueWeight,
'false': 1 - trueWeight
}
}, token ) === 'true';
}
s = 0;
var bucket;
while(!bucket) {
s++;
var samplingRate = mw.config.get( 'wgPopupsSchemaSamplingRate', 0 );
bucket = weightedBoolean(
'ext.Popups.instrumentation.eventLogging',
samplingRate,
s
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment