feat(haproxy): req_tot + req_rate in Stats-API; Backend-Detail + Dashboard nutzen sie

GET /haproxy/stats liefert jetzt req_tot (kumulierte Requests seit
HAProxy-Start) und req_rate (Requests/s im letzten Messfenster).
Backend-Detail zeigt in der Live-Spalte 'N sess · X/s' wenn Traffic
fließt; Dashboard-HAProxy-Card zeigt req/s ebenfalls an.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Debian
2026-05-20 23:03:54 +02:00
parent 95583e9657
commit 9a05e8bca8
4 changed files with 20 additions and 12 deletions

View File

@@ -59,6 +59,7 @@ async function listDomains(): Promise<DomainFull[]> {
interface HAProxyStat {
backend: string; server: string; status: string
sessions: number; bytes_in: number; bytes_out: number
req_tot: number; req_rate: number
last_change_sec: number; health: string
}
async function listHAProxyStats(): Promise<HAProxyStat[]> {
@@ -289,9 +290,11 @@ function ServerPanel({ backendID, haproxyStats }: { backendID: number; haproxySt
if (!stat) return <Text type="secondary" style={{ fontSize: 11 }}></Text>
const color = stat.status === 'UP' ? 'green' : stat.status === 'no check' ? 'default' : 'red'
return (
<Tooltip title={`${fmtBytes(stat.bytes_in)}${fmtBytes(stat.bytes_out)} · ${stat.health || stat.status}`}>
<Tooltip title={`${fmtBytes(stat.bytes_in)}${fmtBytes(stat.bytes_out)} · ${stat.req_tot} req total · ${stat.health || stat.status}`}>
<Tag color={color} style={{ margin: 0, fontSize: 11 }}>{stat.status}</Tag>
<Text type="secondary" style={{ fontSize: 11, marginLeft: 4 }}>{stat.sessions} sess</Text>
<Text type="secondary" style={{ fontSize: 11, marginLeft: 4 }}>
{stat.sessions} sess{stat.req_rate > 0 ? ` · ${stat.req_rate}/s` : ''}
</Text>
</Tooltip>
)
},

View File

@@ -101,6 +101,7 @@ interface AuditEntry {
interface HAProxyBackend {
backend: string; server: string; status: string
sessions: number; bytes_in: number; bytes_out: number
req_tot: number; req_rate: number
last_change_sec: number; health?: string
}
@@ -407,7 +408,7 @@ export default function DashboardPage() {
style={{ margin: 0, fontSize: 10 }}
>{b.status}</Tag>
<Text type="secondary" style={{ fontSize: 11 }}>
{b.sessions} sess · {formatBytes(b.bytes_in)} {formatBytes(b.bytes_out)}
{b.sessions} sess{b.req_rate > 0 ? ` · ${b.req_rate}/s` : ''} · {formatBytes(b.bytes_in)} {formatBytes(b.bytes_out)}
</Text>
<Text type="secondary" style={{ fontSize: 11, marginLeft: 'auto' }}>{formatUptime(b.last_change_sec)}</Text>
</Space>