express: New `httpUptime` metric
parent
e22d8dffc0
commit
ac52fb8a9d
|
@ -26,7 +26,8 @@
|
|||
* Database performance is significantly improved.
|
||||
* Admin UI now has test coverage in CI. (The tests are not enabled by default;
|
||||
see `settings.json`.)
|
||||
* New stats: `activePads`, `lastDisconnected`, `memoryUsageHeap`.
|
||||
* New stats/metrics: `activePads`, `httpUptime`, `lastDisconnected`,
|
||||
`memoryUsageHeap`.
|
||||
* For plugin authors:
|
||||
* New `callAllSerial()` function that invokes hook functions like `callAll()`
|
||||
except it supports asynchronous hook functions.
|
||||
|
|
|
@ -17,6 +17,7 @@ const logger = log4js.getLogger('http');
|
|||
let serverName;
|
||||
const sockets = new Set();
|
||||
const socketsEvents = new events.EventEmitter();
|
||||
let startTime = null;
|
||||
|
||||
exports.server = null;
|
||||
|
||||
|
@ -49,6 +50,7 @@ const closeServer = async () => {
|
|||
};
|
||||
|
||||
exports.createServer = async () => {
|
||||
stats.gauge('httpUptime', () => startTime == null ? 0 : new Date() - startTime);
|
||||
console.log('Report bugs at https://github.com/ether/etherpad-lite/issues');
|
||||
|
||||
serverName = `Etherpad ${settings.getGitCommit()} (https://etherpad.org)`;
|
||||
|
@ -215,6 +217,8 @@ exports.restartServer = async () => {
|
|||
});
|
||||
});
|
||||
await util.promisify(exports.server.listen).bind(exports.server)(settings.port, settings.ip);
|
||||
startTime = new Date();
|
||||
logger.info('HTTP server listening for connections');
|
||||
};
|
||||
|
||||
exports.shutdown = async (hookName, context) => {
|
||||
|
|
Loading…
Reference in New Issue