add initial heap dump endpoint if enabled

This commit is contained in:
Jason Calabrese
2017-03-28 16:57:33 -07:00
parent 4e7d5e721e
commit e7734ad3bf
3 changed files with 14 additions and 0 deletions
+1
View File
@@ -20,3 +20,4 @@ static/bower_components/
coverage/
npm-debug.log
*.heapsnapshot
+12
View File
@@ -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
+1
View File
@@ -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",