mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-18 18:56:25 +00:00
Merge pull request #334 from resin-io/fix/event-explosion
Log CLI events based on original command signature
This commit is contained in:
commit
d9b4753690
@ -1,5 +1,5 @@
|
||||
(function() {
|
||||
var Mixpanel, Promise, _, packageJSON, resin;
|
||||
var Mixpanel, Promise, _, capitanoState, packageJSON, resin;
|
||||
|
||||
_ = require('lodash');
|
||||
|
||||
@ -9,6 +9,8 @@
|
||||
|
||||
resin = require('resin-sdk');
|
||||
|
||||
capitanoState = Promise.promisifyAll(require('capitano').state);
|
||||
|
||||
packageJSON = require('../package.json');
|
||||
|
||||
exports.getLoggerInstance = _.memoize(function() {
|
||||
@ -21,15 +23,17 @@
|
||||
username: resin.auth.whoami(),
|
||||
mixpanel: exports.getLoggerInstance()
|
||||
}).then(function(data) {
|
||||
return data.mixpanel.track("[CLI] " + capitanoCommand.command, {
|
||||
distinct_id: data.username,
|
||||
argv: process.argv.join(' '),
|
||||
version: packageJSON.version,
|
||||
node: process.version,
|
||||
arch: process.arch,
|
||||
resinUrl: data.resinUrl,
|
||||
platform: process.platform,
|
||||
command: capitanoCommand
|
||||
return capitanoState.getMatchCommandAsync(capitanoCommand.command).then(function(command) {
|
||||
return data.mixpanel.track("[CLI] " + (command.signature.toString()), {
|
||||
distinct_id: data.username,
|
||||
argv: process.argv.join(' '),
|
||||
version: packageJSON.version,
|
||||
node: process.version,
|
||||
arch: process.arch,
|
||||
resinUrl: data.resinUrl,
|
||||
platform: process.platform,
|
||||
command: capitanoCommand
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
@ -2,6 +2,7 @@ _ = require('lodash')
|
||||
Mixpanel = require('mixpanel')
|
||||
Promise = require('bluebird')
|
||||
resin = require('resin-sdk')
|
||||
capitanoState = Promise.promisifyAll(require('capitano').state)
|
||||
packageJSON = require('../package.json')
|
||||
|
||||
exports.getLoggerInstance = _.memoize ->
|
||||
@ -13,12 +14,13 @@ exports.trackCommand = (capitanoCommand) ->
|
||||
username: resin.auth.whoami()
|
||||
mixpanel: exports.getLoggerInstance()
|
||||
.then (data) ->
|
||||
data.mixpanel.track "[CLI] #{capitanoCommand.command}",
|
||||
distinct_id: data.username
|
||||
argv: process.argv.join(' ')
|
||||
version: packageJSON.version
|
||||
node: process.version
|
||||
arch: process.arch
|
||||
resinUrl: data.resinUrl
|
||||
platform: process.platform
|
||||
command: capitanoCommand
|
||||
return capitanoState.getMatchCommandAsync(capitanoCommand.command).then (command) ->
|
||||
data.mixpanel.track "[CLI] #{command.signature.toString()}",
|
||||
distinct_id: data.username
|
||||
argv: process.argv.join(' ')
|
||||
version: packageJSON.version
|
||||
node: process.version
|
||||
arch: process.arch
|
||||
resinUrl: data.resinUrl
|
||||
platform: process.platform
|
||||
command: capitanoCommand
|
||||
|
Loading…
Reference in New Issue
Block a user