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) -> api.post '/v1/update', (req, res) ->
utils.mixpanelTrack('Update notification') utils.mixpanelTrack('Update notification')
console.log("Got application update")
application.update() application.update()
res.send(204) res.send(204)

View File

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

View File

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

View File

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

View File

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