Log every mixpanel event and remove redundant logs

This commit is contained in:
Petros Angelatos 2014-06-19 14:49:30 +01:00 committed by Pablo Carranza Vélez
parent d00372b5d2
commit 3e1dd1f922
5 changed files with 1 additions and 7 deletions

View File

@ -24,7 +24,6 @@ api.post '/v1/blink', (req, res) ->
api.post '/v1/update', (req, res) ->
utils.mixpanelTrack('Update notification')
console.log("Got application update")
application.update()
res.send(204)

View File

@ -6,7 +6,6 @@ utils = require './utils'
{spawn} = require 'child_process'
bootstrap = require './bootstrap'
console.log('Supervisor started..')
utils.mixpanelTrack('Supervisor start')
knex('config').select('value').where(key: 'uuid').then ([uuid]) ->

View File

@ -58,7 +58,6 @@ exports.kill = kill = (app) ->
exports.start = start = (app) ->
docker.getImage(app.imageId).inspectAsync()
.catch (error) ->
console.log("Pulling image:", app.imageId)
utils.mixpanelTrack('Application install', app)
docker.createImageAsync(fromImage: app.imageId)
.then (stream) ->
@ -115,7 +114,6 @@ exports.start = start = (app) ->
)
.tap ->
utils.mixpanelTrack('Application start', app.imageId)
console.log('Started container:', app.imageId)
exports.restart = restart = (app) ->
kill(app)

View File

@ -49,10 +49,8 @@ exports.update = ->
.spread (localImageInfo, currentSupervisorImage) ->
if localImageInfo.id == currentSupervisorImage
utils.mixpanelTrack('Supervisor up to date')
console.log('Supervisor is up to date')
return
utils.mixpanelTrack('Supervisor update start', image: localImageInfo.id)
console.log('Creating updated supervisor container:', localImage)
docker.createContainerAsync(
Image: localImage
Cmd: ['/start']
@ -79,5 +77,4 @@ exports.update = ->
process.exit()
.catch (err) ->
utils.mixpanelTrack('Supervisor update failed', error: err)
console.error('Error updating supervisor:', err)
throw err

View File

@ -17,6 +17,7 @@ exports.mixpanelProperties = mixpanelProperties =
username: require('/boot/config.json').username
exports.mixpanelTrack = (event, properties={}) ->
console.log('Event:', event, JSON.stringify(properties))
# Mutation is bad, and it should feel bad
properties = _.assign(_.cloneDeep(properties), mixpanelProperties)