fix(beszel): use bandwidth field (b) for public interface traffic

In Beszel, ns/nr are all-interface traffic (loopback, docker bridges)
while b is public interface bandwidth. Use b with ns/nr fallback for
both system stats and container network charts to match what the
grid/table display via netBytes.
This commit is contained in:
Thomas Camlong committed 2026-06-08 15:57:18 +02:00
1 parent 515b285ef7
commit 2bf014ba43
2 files changed
+4 -4

No files matched your search

@@ -76,9 +76,9 @@ export default function BeszelSystemStatsWidget({
[t],
);
const networkMap = useCallback(
(s: { ns: number; nr: number }) => ({
[t("chart.network.sent")]: s.ns,
[t("chart.network.recv")]: s.nr,
(s: { ns: number; nr: number; b?: [number, number] }) => ({
[t("chart.network.sent")]: s.b?.[0] ?? s.ns,
[t("chart.network.recv")]: s.b?.[1] ?? s.nr,
}),
[t],
);
@@ -85,7 +85,7 @@ type ContainerExtractor = (container: BeszelContainerStatsRecord["stats"][number
const defaultContainerExtractors: Record<string, ContainerExtractor> = {
cpu: (c) => c?.c ?? 0,
memory: (c) => c?.m ?? 0,
network: (c) => (c?.ns ?? 0) + (c?.nr ?? 0),
network: (c) => c?.b ? c.b[0] + c.b[1] : (c?.ns ?? 0) + (c?.nr ?? 0),
};
export const useDockerChartData = (