diff --git a/build/events.js b/build/events.js index d1a99d07..7d63cda7 100644 --- a/build/events.js +++ b/build/events.js @@ -1,10 +1,12 @@ // Generated by CoffeeScript 1.12.5 -var Mixpanel, Promise, _, packageJSON, resin; +var Mixpanel, Promise, Raven, _, packageJSON, resin; _ = require('lodash'); Mixpanel = require('mixpanel'); +Raven = require('raven'); + Promise = require('bluebird'); resin = require('resin-sdk-preconfigured'); @@ -22,15 +24,23 @@ exports.trackCommand = function(capitanoCommand) { resinUrl: resin.settings.get('resinUrl'), username: resin.auth.whoami(), mixpanel: exports.getLoggerInstance() - }).then(function(data) { + }).then(function(arg) { + var mixpanel, resinUrl, username; + username = arg.username, resinUrl = arg.resinUrl, mixpanel = arg.mixpanel; return capitanoStateGetMatchCommandAsync(capitanoCommand.command).then(function(command) { - return data.mixpanel.track("[CLI] " + (command.signature.toString()), { - distinct_id: data.username, + Raven.mergeContext({ + user: { + id: username, + username: username + } + }); + return mixpanel.track("[CLI] " + (command.signature.toString()), { + distinct_id: username, argv: process.argv.join(' '), version: packageJSON.version, node: process.version, arch: process.arch, - resinUrl: data.resinUrl, + resinUrl: resinUrl, platform: process.platform, command: capitanoCommand }); diff --git a/lib/events.coffee b/lib/events.coffee index d4cc64aa..57de2c87 100644 --- a/lib/events.coffee +++ b/lib/events.coffee @@ -1,5 +1,6 @@ _ = require('lodash') Mixpanel = require('mixpanel') +Raven = require('raven') Promise = require('bluebird') resin = require('resin-sdk-preconfigured') packageJSON = require('../package.json') @@ -14,14 +15,18 @@ exports.trackCommand = (capitanoCommand) -> resinUrl: resin.settings.get('resinUrl') username: resin.auth.whoami() mixpanel: exports.getLoggerInstance() - .then (data) -> + .then ({ username, resinUrl, mixpanel }) -> return capitanoStateGetMatchCommandAsync(capitanoCommand.command).then (command) -> - data.mixpanel.track "[CLI] #{command.signature.toString()}", - distinct_id: data.username + Raven.mergeContext(user: { + id: username, + username + }) + mixpanel.track "[CLI] #{command.signature.toString()}", + distinct_id: username argv: process.argv.join(' ') version: packageJSON.version node: process.version arch: process.arch - resinUrl: data.resinUrl + resinUrl: resinUrl platform: process.platform command: capitanoCommand