mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
feat: show connetion count on /info
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
"ip": "IP <strong>%1</strong>",
|
||||
"nodes-responded": "%1 nodes responded within %2ms!",
|
||||
"host": "host",
|
||||
"primary": "primary / run jobs",
|
||||
"primary": "primary / jobs",
|
||||
"pid": "pid",
|
||||
"nodejs": "nodejs",
|
||||
"online": "online",
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
"registered": "Registered",
|
||||
"sockets": "Sockets",
|
||||
"connection-count": "Connection Count",
|
||||
"guests": "Guests",
|
||||
|
||||
"info": "Info"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
const topics = require('../../topics');
|
||||
const io = require('..');
|
||||
const webserver = require('../../webserver');
|
||||
|
||||
const totals = {};
|
||||
|
||||
@@ -94,6 +95,7 @@ SocketRooms.getLocalStats = function () {
|
||||
onlineGuestCount: 0,
|
||||
onlineRegisteredCount: 0,
|
||||
socketCount: 0,
|
||||
connectionCount: webserver.getConnectionCount(),
|
||||
users: {
|
||||
categories: 0,
|
||||
recent: 0,
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<td class="fw-bold">[[admin/development/info:process-memory]]</td>
|
||||
<td class="fw-bold">[[admin/development/info:system-memory]]</td>
|
||||
<td class="fw-bold">[[admin/development/info:load]]</td>
|
||||
<td class="fw-bold">[[admin/development/info:uptime]]</td>
|
||||
<td class="fw-bold text-end">[[admin/development/info:uptime]]</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="text-xs">
|
||||
@@ -34,7 +34,8 @@
|
||||
<td>
|
||||
<span title="[[admin/development/info:registered]]">{info.stats.onlineRegisteredCount}</span> /
|
||||
<span title="[[admin/development/info:guests]]">{info.stats.onlineGuestCount}</span> /
|
||||
<span title="[[admin/development/info:sockets]]">{info.stats.socketCount}</span>
|
||||
<span title="[[admin/development/info:sockets]]">{info.stats.socketCount}</span> /
|
||||
<span title="[[admin/development/info:connection-count]]">{info.stats.connectionCount}</span>
|
||||
</td>
|
||||
<td>{info.git.branch}@<a href="https://github.com/NodeBB/NodeBB/commit/{info.git.hash}" target="_blank">{info.git.hashShort}</a></td>
|
||||
<td>{info.process.cpuUsage}%</td>
|
||||
@@ -46,7 +47,7 @@
|
||||
<span title="[[admin/development/info:total-memory-os]]">{info.os.totalmem} gb</span>
|
||||
</td>
|
||||
<td>{info.os.load}</td>
|
||||
<td>{info.process.uptimeHumanReadable}</td>
|
||||
<td class="text-end">{info.process.uptimeHumanReadable}</td>
|
||||
</tr>
|
||||
{{{ end }}}
|
||||
</tbody>
|
||||
|
||||
@@ -76,6 +76,10 @@ exports.destroy = function (callback) {
|
||||
}
|
||||
};
|
||||
|
||||
exports.getConnectionCount = function () {
|
||||
return Object.keys(connections).length;
|
||||
};
|
||||
|
||||
exports.listen = async function () {
|
||||
emailer.registerApp(app);
|
||||
setupExpressApp(app);
|
||||
|
||||
Reference in New Issue
Block a user