mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-20 06:07:57 +00:00
Log every mixpanel event and remove redundant logs
This commit is contained in:
parent
d00372b5d2
commit
3e1dd1f922
@ -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)
|
||||
|
||||
|
@ -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]) ->
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user