mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-20 14:13:08 +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) ->
|
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)
|
||||||
|
|
||||||
|
@ -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]) ->
|
||||||
|
@ -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)
|
||||||
|
@ -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
|
||||||
|
@ -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)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user