mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-05-02 00:52:57 +00:00
meta logs system prefix
This commit is contained in:
parent
b24a06a935
commit
01f6794ccd
@ -28,22 +28,22 @@ publish = do ->
|
|||||||
|
|
||||||
knex('config').select('value').where(key: 'uuid').then ([ uuid ]) ->
|
knex('config').select('value').where(key: 'uuid').then ([ uuid ]) ->
|
||||||
uuid = uuid.value
|
uuid = uuid.value
|
||||||
channel = "device-#{uuid}-"
|
channel = "device-#{uuid}-logs"
|
||||||
|
|
||||||
# Redefine original function
|
# Redefine original function
|
||||||
publish = (message, channelPrefix="logs") ->
|
publish = (message) ->
|
||||||
pubnub.publish({ channel + channelPrefix, message })
|
pubnub.publish({ channel, message })
|
||||||
|
|
||||||
# Replay queue now that we have initialised the publish function
|
# Replay queue now that we have initialised the publish function
|
||||||
publish(args...) for args in publishQueue
|
publish(args...) for args in publishQueue
|
||||||
|
|
||||||
return -> publishQueue.push(arguments)
|
return -> publishQueue.push(arguments)
|
||||||
|
|
||||||
exports.logSupervisorEvent = logSupervisorEvent = (message) ->
|
exports.logSystemEvent = logSystemEvent = (message) ->
|
||||||
publish(message, "meta-logs")
|
publish("[system] " + message)
|
||||||
|
|
||||||
exports.kill = kill = (app) ->
|
exports.kill = kill = (app) ->
|
||||||
logSupervisorEvent( 'Killing application ' + app.imageId )
|
logSystemEvent('Killing application ' + app.imageId)
|
||||||
utils.mixpanelTrack('Application kill', app)
|
utils.mixpanelTrack('Application kill', app)
|
||||||
updateDeviceInfo(status: 'Stopping')
|
updateDeviceInfo(status: 'Stopping')
|
||||||
container = docker.getContainer(app.containerId)
|
container = docker.getContainer(app.containerId)
|
||||||
@ -101,7 +101,7 @@ exports.start = start = (app) ->
|
|||||||
docker.getImage(app.imageId).inspectAsync()
|
docker.getImage(app.imageId).inspectAsync()
|
||||||
.catch (error) ->
|
.catch (error) ->
|
||||||
utils.mixpanelTrack('Application install', app)
|
utils.mixpanelTrack('Application install', app)
|
||||||
logSupervisorEvent('Installing application ' + app.imageId)
|
logSystemEvent('Installing application ' + app.imageId)
|
||||||
updateDeviceInfo(status: 'Downloading')
|
updateDeviceInfo(status: 'Downloading')
|
||||||
docker.createImageAsync(fromImage: app.imageId)
|
docker.createImageAsync(fromImage: app.imageId)
|
||||||
.then (stream) ->
|
.then (stream) ->
|
||||||
@ -168,7 +168,7 @@ exports.start = start = (app) ->
|
|||||||
)
|
)
|
||||||
.tap ->
|
.tap ->
|
||||||
utils.mixpanelTrack('Application start', app.imageId)
|
utils.mixpanelTrack('Application start', app.imageId)
|
||||||
logSupervisorEvent('Starting application ' + app.imageId)
|
logSystemEvent('Starting application ' + app.imageId)
|
||||||
.finally ->
|
.finally ->
|
||||||
updateDeviceInfo(status: 'Idle')
|
updateDeviceInfo(status: 'Idle')
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ exports.update = update = ->
|
|||||||
localApp = apps[imageId]
|
localApp = apps[imageId]
|
||||||
app = remoteApps[imageId]
|
app = remoteApps[imageId]
|
||||||
utils.mixpanelTrack('Application update', app)
|
utils.mixpanelTrack('Application update', app)
|
||||||
logSupervisorEvent('Updating application')
|
logSystemEvent('Updating application')
|
||||||
kill(localApp)
|
kill(localApp)
|
||||||
.then ->
|
.then ->
|
||||||
start(app)
|
start(app)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user