revert: remove heapdump

This commit is contained in:
Barış Soner Uşaklı
2025-07-11 10:22:37 -04:00
parent 27aab92191
commit e74996fbb9
6 changed files with 2 additions and 48 deletions

View File

@@ -22,6 +22,5 @@
"connection-count": "Connection Count",
"guests": "Guests",
"info": "Info",
"heap-dump": "Heap Dump"
"info": "Info"
}

View File

@@ -174,8 +174,6 @@ paths:
$ref: 'read/admin/advanced/cache.yaml'
/api/admin/advanced/cache/dump:
$ref: 'read/admin/advanced/cache/dump.yaml'
/api/admin/advanced/heap/dump:
$ref: 'read/admin/advanced/heap/dump.yaml'
/api/admin/development/logger:
$ref: 'read/admin/development/logger.yaml'
/api/admin/development/info:

View File

@@ -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.

View File

@@ -143,22 +143,3 @@ async function getGitInfo() {
]);
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);
}
});
});
};

View File

@@ -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}/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/heap/dump`, middleware.ensureLoggedIn, helpers.tryRoute(controllers.admin.info.getHeapdump));
const multer = require('multer');
const storage = multer.diskStorage({});

View File

@@ -5,12 +5,7 @@
</h5>
<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>
<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>
<span>[[admin/development/info:nodes-responded, {nodeCount}, {timeout}]]</span>
<div class="table-responsive">
<table class="table table-sm text-sm">
<thead>