mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
revert: remove heapdump
This commit is contained in:
@@ -22,6 +22,5 @@
|
|||||||
"connection-count": "Connection Count",
|
"connection-count": "Connection Count",
|
||||||
"guests": "Guests",
|
"guests": "Guests",
|
||||||
|
|
||||||
"info": "Info",
|
"info": "Info"
|
||||||
"heap-dump": "Heap Dump"
|
|
||||||
}
|
}
|
||||||
@@ -174,8 +174,6 @@ paths:
|
|||||||
$ref: 'read/admin/advanced/cache.yaml'
|
$ref: 'read/admin/advanced/cache.yaml'
|
||||||
/api/admin/advanced/cache/dump:
|
/api/admin/advanced/cache/dump:
|
||||||
$ref: 'read/admin/advanced/cache/dump.yaml'
|
$ref: 'read/admin/advanced/cache/dump.yaml'
|
||||||
/api/admin/advanced/heap/dump:
|
|
||||||
$ref: 'read/admin/advanced/heap/dump.yaml'
|
|
||||||
/api/admin/development/logger:
|
/api/admin/development/logger:
|
||||||
$ref: 'read/admin/development/logger.yaml'
|
$ref: 'read/admin/development/logger.yaml'
|
||||||
/api/admin/development/info:
|
/api/admin/development/info:
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
get:
|
|
||||||
tags:
|
|
||||||
- admin
|
|
||||||
summary: Get nodejs heap snapshot
|
|
||||||
description: Downloads a Node.js heap snapshot for memory analysis.
|
|
||||||
parameters: []
|
|
||||||
responses:
|
|
||||||
"200":
|
|
||||||
description: Heap snapshot file (in .heapsnapshot format)
|
|
||||||
content:
|
|
||||||
application/octet-stream:
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
format: binary
|
|
||||||
examples:
|
|
||||||
heapSnapshot:
|
|
||||||
summary: Example Heap Snapshot Download
|
|
||||||
description: A binary heap snapshot file.
|
|
||||||
@@ -143,22 +143,3 @@ async function getGitInfo() {
|
|||||||
]);
|
]);
|
||||||
return { hash: hash, hashShort: hash.slice(0, 6), branch: branch };
|
return { hash: hash, hashShort: hash.slice(0, 6), branch: branch };
|
||||||
}
|
}
|
||||||
|
|
||||||
infoController.getHeapdump = async function (req, res) {
|
|
||||||
req.setTimeout(0);
|
|
||||||
const v8 = require('v8');
|
|
||||||
const path = require('path');
|
|
||||||
const fs = require('fs');
|
|
||||||
const filename = path.join(nconf.get('upload_path'), `heapdump-${Date.now()}.heapsnapshot`);
|
|
||||||
const stored = v8.writeHeapSnapshot(filename, {});
|
|
||||||
res.download(stored, 'heapdump.heapsnapshot', (err) => {
|
|
||||||
if (err) {
|
|
||||||
winston.error(err.stack);
|
|
||||||
}
|
|
||||||
fs.unlink(stored, (unlinkErr) => {
|
|
||||||
if (unlinkErr) {
|
|
||||||
winston.error(unlinkErr.stack);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
@@ -81,7 +81,6 @@ function apiRoutes(router, name, middleware, controllers) {
|
|||||||
router.get(`/api/${name}/groups/:groupname/csv`, middleware.ensureLoggedIn, helpers.tryRoute(controllers.admin.groups.getCSV));
|
router.get(`/api/${name}/groups/:groupname/csv`, middleware.ensureLoggedIn, helpers.tryRoute(controllers.admin.groups.getCSV));
|
||||||
router.get(`/api/${name}/analytics`, middleware.ensureLoggedIn, helpers.tryRoute(controllers.admin.dashboard.getAnalytics));
|
router.get(`/api/${name}/analytics`, middleware.ensureLoggedIn, helpers.tryRoute(controllers.admin.dashboard.getAnalytics));
|
||||||
router.get(`/api/${name}/advanced/cache/dump`, middleware.ensureLoggedIn, helpers.tryRoute(controllers.admin.cache.dump));
|
router.get(`/api/${name}/advanced/cache/dump`, middleware.ensureLoggedIn, helpers.tryRoute(controllers.admin.cache.dump));
|
||||||
router.get(`/api/${name}/advanced/heap/dump`, middleware.ensureLoggedIn, helpers.tryRoute(controllers.admin.info.getHeapdump));
|
|
||||||
|
|
||||||
const multer = require('multer');
|
const multer = require('multer');
|
||||||
const storage = multer.diskStorage({});
|
const storage = multer.diskStorage({});
|
||||||
|
|||||||
@@ -5,12 +5,7 @@
|
|||||||
</h5>
|
</h5>
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="d-flex flex-wrap justify-content-between align-items-center mb-2">
|
|
||||||
<span>[[admin/development/info:nodes-responded, {nodeCount}, {timeout}]]</span>
|
<span>[[admin/development/info:nodes-responded, {nodeCount}, {timeout}]]</span>
|
||||||
<a href="{config.relative_path}/api/admin/advanced/heap/dump" class="btn btn-primary btn-sm">
|
|
||||||
<i class="fa fa-download"></i> [[admin/development/info:heap-dump]]
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-sm text-sm">
|
<table class="table table-sm text-sm">
|
||||||
<thead>
|
<thead>
|
||||||
|
|||||||
Reference in New Issue
Block a user