mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 16:06:16 -04:00
server: Log stats (metrics) on fatal error
This might help users troubleshoot rare crashes.
This commit is contained in:
parent
d2610284ad
commit
9b82d1d37d
1 changed files with 2 additions and 2 deletions
|
@ -46,6 +46,7 @@ const hooks = require('../static/js/pluginfw/hooks');
|
||||||
const pluginDefs = require('../static/js/pluginfw/plugin_defs');
|
const pluginDefs = require('../static/js/pluginfw/plugin_defs');
|
||||||
const plugins = require('../static/js/pluginfw/plugins');
|
const plugins = require('../static/js/pluginfw/plugins');
|
||||||
const settings = require('./utils/Settings');
|
const settings = require('./utils/Settings');
|
||||||
|
const stats = require('./stats');
|
||||||
|
|
||||||
const logger = log4js.getLogger('server');
|
const logger = log4js.getLogger('server');
|
||||||
|
|
||||||
|
@ -104,8 +105,6 @@ exports.start = async () => {
|
||||||
// Check if Etherpad version is up-to-date
|
// Check if Etherpad version is up-to-date
|
||||||
UpdateCheck.check();
|
UpdateCheck.check();
|
||||||
|
|
||||||
// start up stats counting system
|
|
||||||
const stats = require('./stats');
|
|
||||||
stats.gauge('memoryUsage', () => process.memoryUsage().rss);
|
stats.gauge('memoryUsage', () => process.memoryUsage().rss);
|
||||||
stats.gauge('memoryUsageHeap', () => process.memoryUsage().heapUsed);
|
stats.gauge('memoryUsageHeap', () => process.memoryUsage().heapUsed);
|
||||||
|
|
||||||
|
@ -215,6 +214,7 @@ exports.exit = async (err = null) => {
|
||||||
logger.info('Received SIGTERM signal');
|
logger.info('Received SIGTERM signal');
|
||||||
err = null;
|
err = null;
|
||||||
} else if (err != null) {
|
} else if (err != null) {
|
||||||
|
logger.error(`Metrics at time of fatal error:\n${JSON.stringify(stats.toJSON(), null, 2)}`);
|
||||||
logger.error(err.stack || err.toString());
|
logger.error(err.stack || err.toString());
|
||||||
process.exitCode = 1;
|
process.exitCode = 1;
|
||||||
if (exitCalled) {
|
if (exitCalled) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue