Commit 352496124f98e064548ab67a0614f18fbf61cad4
1 parent
cd4feda874
Exists in
master
and in
1 other branch
matrix.start_time_from_now
Showing 2 changed files with 7 additions and 2 deletions Side-by-side Diff
lib/apiserver/routers/matrix.js
1 | 1 | const express = require('express'); |
2 | +const moment = require('moment'); | |
2 | 3 | |
3 | 4 | const os = require('os'); |
4 | 5 | const matrix = require('../../matrix'); |
... | ... | @@ -7,7 +8,9 @@ const router = express.Router(); |
7 | 8 | module.exports = router; |
8 | 9 | |
9 | 10 | const pageIndex = (req, res) => { |
10 | - matrix.uptime = process.uptime(); | |
11 | + matrix.ts = new Date(); | |
12 | + matrix.start_time_from_now = moment(matrix.start_time).fromNow(); | |
13 | + matrix.uptime_secs = process.uptime(); | |
11 | 14 | matrix.loadavg = os.loadavg(); |
12 | 15 | matrix.workdir = process.cwd; |
13 | 16 | matrix.memory_usage = process.memoryUsage(); |
lib/matrix.js
... | ... | @@ -3,8 +3,10 @@ const os = require('os'); |
3 | 3 | |
4 | 4 | module.exports = { |
5 | 5 | pid: process.pid, |
6 | + ts: new Date(), | |
6 | 7 | start_time: new Date(), |
7 | - uptime: process.uptime(), | |
8 | + start_time_from_now: null, | |
9 | + uptime_secs: process.uptime(), | |
8 | 10 | hostname: os.hostname(), |
9 | 11 | loadavg: os.loadavg(), |
10 | 12 | workdir: process.cwd(), |