Track --number param

pull/182/head
Maciej Winnicki 2019-08-26 22:03:27 +02:00
parent 29d660623f
commit 4d5f29b209
No known key found for this signature in database
GPG Key ID: D0B924AEC4BE0E44
2 changed files with 4 additions and 3 deletions

View File

@ -26,7 +26,7 @@ if (program.args.length === 0) {
/**
* Init usage statistics
*/
const stats = usageStats(!program.disableUsageStats);
const stats = usageStats(!program.disableUsageStats, program);
stats.track('runtime', 'init');
stats.time('runtime', 'runtime');

View File

@ -9,7 +9,7 @@ const pkg = require('../package.json');
const trackingID = 'UA-129582046-1';
// Usage stats
function Stats(enabled) {
function Stats(enabled, opts) {
this.timer = {};
if (enabled === true) {
@ -30,6 +30,7 @@ function Stats(enabled) {
tracker.set('cd2', process.arch); // arch
tracker.set('cd3', process.version.match(/^v(\d+\.\d+)/)[1]); // Node version
tracker.set('cd4', isDocker()); // is Docker
tracker.set('cd5', opts.number !== 10); // is --number parameter set
this.tracker = tracker;
}
@ -63,4 +64,4 @@ Stats.prototype.timeEnd = function timeEnd(category, action, cb) {
this.tracker.timing(category, action, Date.now() - this.timer[category][action]).send(cb);
};
module.exports = enabled => new Stats(enabled);
module.exports = (enabled, opts) => new Stats(enabled, opts);