mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-06 12:31:33 +01:00
added ability to take heap snapshots
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
"express-session": "^1.8.2",
|
||||
"gm": "1.16.0",
|
||||
"gravatar": "^1.1.0",
|
||||
"heapdump": "^0.3.0",
|
||||
"less": "^1.7.5",
|
||||
"logrotate-stream": "^0.2.3",
|
||||
"mkdirp": "~0.5.0",
|
||||
|
||||
@@ -299,4 +299,8 @@ SocketAdmin.getVoters = function(socket, pid, callback) {
|
||||
});
|
||||
};
|
||||
|
||||
SocketAdmin.takeHeapSnapshot = function(socket, data, callback) {
|
||||
require('heapdump').writeSnapshot(callback);
|
||||
};
|
||||
|
||||
module.exports = SocketAdmin;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="col-lg-9">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Logger Settings</div>
|
||||
<div class="panel-body">
|
||||
<div class="panel-body">
|
||||
<p>
|
||||
By enabling the check boxes, you will receive logs to your terminal. If you specify a path, logs will then be saved to a file instead. HTTP logging is useful for collecting statistics about who, when, and what people access on your forum. In addition to logging HTTP requests, we can also log socket.io events. Socket.io logging, in combination with redis-cli monitor, can be very helpful for learning NodeBB's internals.
|
||||
</p>
|
||||
@@ -31,6 +31,13 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Heap Snapshot</div>
|
||||
<div class="panel-body">
|
||||
<button class="btn btn-primary" id="heap-snapshot">Take Heap Snapshot</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3">
|
||||
@@ -47,5 +54,14 @@
|
||||
<script>
|
||||
require(['admin/settings'], function(Settings) {
|
||||
Settings.prepare();
|
||||
|
||||
$('#heap-snapshot').on('click', function() {
|
||||
socket.emit('admin.takeHeapSnapshot', function(err, filename) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
app.alertSuccess('Heap Snapshot saved! ' + filename);
|
||||
});
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user