feat(monitoring): improve network activity metrics with live domain request rates and backend identifiers
This commit is contained in:
@@ -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: [],
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user