send monotonic timestamp as well

This commit is contained in:
Girish Ramakrishnan
2015-11-02 14:26:15 -08:00
parent 63c10e8f02
commit 5b3d81aeeb
2 changed files with 7 additions and 2 deletions
+6 -1
View File
@@ -506,7 +506,12 @@ function getLogs(appId, lines, follow, callback) {
if (!obj) return undefined;
var source = obj.CONTAINER_NAME.slice(app.id.length + 1);
return JSON.stringify({ timestamp: obj.__REALTIME_TIMESTAMP, message: obj.MESSAGE, source: source || 'main' });
return JSON.stringify({
realtimeTimestamp: obj.__REALTIME_TIMESTAMP,
monotonicTimestamp: obj.__MONOTONIC_TIMESTAMP,
message: obj.MESSAGE,
source: source || 'main'
});
});
transformStream.close = cp.kill.bind(cp, 'SIGKILL'); // closing stream kills the child process
+1 -1
View File
@@ -309,7 +309,7 @@ function getLogStream(req, res, next) {
res.on('close', logStream.close);
logStream.on('data', function (data) {
var obj = JSON.parse(data);
res.write(sse(obj.timestamp, JSON.stringify(obj))); // send timestamp as id
res.write(sse(obj.monotonicTimestamp, JSON.stringify(obj))); // send timestamp as id
});
logStream.on('end', res.end.bind(res));
logStream.on('error', res.end.bind(res, null));