mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-12 09:18:59 +00:00
doc: Document statsvInstrumentation module
Bug: T158236 Change-Id: I138a1ef5305c0b49415d5f2a914ba45fd6aa869b
This commit is contained in:
parent
471e56111d
commit
e4f4041846
BIN
resources/dist/index.js
vendored
BIN
resources/dist/index.js
vendored
Binary file not shown.
BIN
resources/dist/index.js.map
vendored
BIN
resources/dist/index.js.map
vendored
Binary file not shown.
|
@ -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
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue