mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
add initial heap dump endpoint if enabled
This commit is contained in:
@@ -20,3 +20,4 @@ static/bower_components/
|
||||
coverage/
|
||||
|
||||
npm-debug.log
|
||||
*.heapsnapshot
|
||||
|
||||
@@ -63,6 +63,18 @@ function create (env, ctx) {
|
||||
res.sendFile(__dirname + '/swagger.yaml');
|
||||
});
|
||||
|
||||
if (env.settings.isEnabled('dumps')) {
|
||||
var heapdump = require('heapdump');
|
||||
app.get('/api/v2/dumps/start', function (req, res) {
|
||||
var path = new Date().toISOString() + '.heapsnapshot';
|
||||
path = _.replace(path, ':', '-');
|
||||
console.info('writing dump to', path);
|
||||
heapdump.writeSnapshot(path);
|
||||
res.send('wrote dump to ' + path);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//app.get('/package.json', software);
|
||||
|
||||
// define static server
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
"express-extension-to-accept": "0.0.2",
|
||||
"forever": "~0.15.2",
|
||||
"git-rev": "git://github.com/bewest/git-rev.git",
|
||||
"heapdump": "^0.3.7",
|
||||
"jquery": "^2.1.4",
|
||||
"jsonwebtoken": "^7.1.9",
|
||||
"lodash": "^4.16.4",
|
||||
|
||||
Reference in New Issue
Block a user