admin/monitoring: hover connections to know number of different IPs
Massimo Melina committed
Mar 17, 2024 at 22:27 UTC
dd9b0ecceac3c3fd1185d7c009d0ce7ae9ad83fa
2 files changed
+4
-2
admin/src/MonitorPage.ts
+1
-1
@@ -40,7 +40,7 @@ function MoreInfo() {
40
}),
41
(allInfo || xl) && pair('http', { label: "HTTP", render: port }),
42
(allInfo || xl) && pair('https', { label: "HTTPS", render: port }),
43
- (allInfo || sm) && pair('connections'),
43
+ (allInfo || sm) && pair('connections', { title: () => `${status.ips} IP(s)` }),
44
pair('sent', { render: formatBytes, minWidth: '4em' }),
45
(allInfo || sm) && pair('got', { render: formatBytes, minWidth: '4em' }),
46
pair('outSpeed', { label: "Output speed", render: formatSpeedK }),
src/api.monitor.ts
+3
-1
@@ -82,12 +82,14 @@ export default {
82
83
async *get_connection_stats() {
84
while (1) {
85
+ const filtered = getConnections().filter(x => !ignore(x))
86
yield {
87
outSpeed: totalOutSpeed,
88
inSpeed: totalInSpeed,
89
got: totalGot,
90
sent: totalSent,
90
- connections: _.sumBy(getConnections(), x => ignore(x) ? 0 : 1),
91
+ connections: filtered.length,
92
+ ips: _.uniqBy(filtered, x => x.ip).length,
93
}
94
await wait(1000)
95
}