doc: Document statsvInstrumentation module

Bug: T158236
Change-Id: I138a1ef5305c0b49415d5f2a914ba45fd6aa869b
This commit is contained in:
Sam Smith 2017-05-24 10:45:49 +01:00
parent 471e56111d
commit e4f4041846
3 changed files with 11 additions and 8 deletions

Binary file not shown.

Binary file not shown.

View file

@ -1,13 +1,20 @@
/**
* Whether statsv logging is enabled
* @module statsvInstrumentation
*/
/**
* Gets whether Graphite logging (via [the statsv HTTP endpoint][0]) is enabled
* for duration of the browser session. The sampling rate is controlled by
* `wgPopupsStatsvSamplingRate`.
*
* [0]: https://wikitech.wikimedia.org/wiki/Graphite#statsv
*
* @param {mw.user} user The `mw.user` singleton instance
* @param {mw.Map} config The `mw.config` singleton instance
* @param {mw.experiments} experiments The `mw.experiments` singleton instance
* @returns {bool} Whether the statsv logging is enabled for the user
* given the sampling rate.
* @returns {Boolean}
*/
function isEnabled( user, config, experiments ) {
exports.isEnabled = function isEnabled( user, config, experiments ) {
var samplingRate = config.get( 'wgPopupsStatsvSamplingRate', 0 ),
bucket = experiments.getBucket( {
name: 'ext.Popups.statsv',
@ -19,8 +26,4 @@ function isEnabled( user, config, experiments ) {
}, user.sessionId() );
return bucket === 'A';
}
module.exports = {
isEnabled: isEnabled
};