feat(monitoring): improve network activity metrics with live domain request rates and backend identifiers

This commit is contained in:
2026-04-25 20:37:28 +00:00
parent 97017ede98
commit b3751abd17
18 changed files with 318 additions and 93 deletions
+11 -5
View File
@@ -50,19 +50,21 @@ export class SecurityHandler {
localAddress: conn.destination.ip,
startTime: conn.startTime,
protocol: conn.type === 'http' ? 'https' : conn.type as any,
state: conn.status as any,
state: conn.status === 'active' ? 'connected' : conn.status as any,
bytesReceived: (conn as any)._throughputIn || 0,
bytesSent: (conn as any)._throughputOut || 0,
connectionCount: conn.bytesTransferred || 1,
}));
const totalConnections = connectionInfos.reduce((sum, conn) => sum + (conn.connectionCount || 1), 0);
const summary = {
total: connectionInfos.length,
total: totalConnections,
byProtocol: connectionInfos.reduce((acc, conn) => {
acc[conn.protocol] = (acc[conn.protocol] || 0) + 1;
acc[conn.protocol] = (acc[conn.protocol] || 0) + (conn.connectionCount || 1);
return acc;
}, {} as { [protocol: string]: number }),
byState: connectionInfos.reduce((acc, conn) => {
acc[conn.state] = (acc[conn.state] || 0) + 1;
acc[conn.state] = (acc[conn.state] || 0) + (conn.connectionCount || 1);
return acc;
}, {} as { [state: string]: number }),
};
@@ -104,6 +106,8 @@ export class SecurityHandler {
requestsPerSecond: networkStats.requestsPerSecond || 0,
requestsTotal: networkStats.requestsTotal || 0,
backends: networkStats.backends || [],
frontendProtocols: networkStats.frontendProtocols || null,
backendProtocols: networkStats.backendProtocols || null,
};
}
@@ -120,6 +124,8 @@ export class SecurityHandler {
requestsPerSecond: 0,
requestsTotal: 0,
backends: [],
frontendProtocols: null,
backendProtocols: null,
};
}
)
@@ -335,4 +341,4 @@ export class SecurityHandler {
limits: [],
};
}
}
}
+1
View File
@@ -302,6 +302,7 @@ export class StatsHandler {
startTime: 0,
bytesIn: tp?.in || 0,
bytesOut: tp?.out || 0,
connectionCount: count,
});
}