From 2810cd35625f861c7ed981097c22e6c10cfc7d00 Mon Sep 17 00:00:00 2001 From: gorkem-bwl Date: Fri, 10 Jul 2026 03:16:42 +0300 Subject: [PATCH] fix(infrastructure): trigger network "no traffic" notice on interface name only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The notice at the top of the network charts was firing whenever the aggregated per-second delta was zero across all interfaces. That is a false positive when Capture is running on a real host but the polling interval is >= 1 minute and the aggregation bucket is also 1 minute — first == last in the bucket, delta is zero, but the interface has plenty of real traffic in its cumulative counters. Base the notice on interface names instead: only show it when the ONLY interfaces Capture reports are loopback / container-bridge names (lo, lo0, docker0). Real NICs (enp0s6, eth0, wlan0, tunN, vethN, brN, etc.) keep the notice hidden even when the aggregation currently reports zero throughput. The underlying zero-throughput bug (single-sample buckets producing zero deltas) is tracked separately. --- .../Details/Components/ChartsNetwork.tsx | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/client/src/Pages/Infrastructure/Details/Components/ChartsNetwork.tsx b/client/src/Pages/Infrastructure/Details/Components/ChartsNetwork.tsx index c7ebac5be..dfb485a2b 100644 --- a/client/src/Pages/Infrastructure/Details/Components/ChartsNetwork.tsx +++ b/client/src/Pages/Infrastructure/Details/Components/ChartsNetwork.tsx @@ -63,10 +63,20 @@ const getChartConfigs = ( return configs; }; -const hasAnyNetworkTraffic = (checks: HardwareCheckStats[]): boolean => - checks.some((c) => - c.net?.some((iface) => iface.bytesSentPerSecond > 0 || iface.deltaBytesRecv > 0) - ); +// Loopback / bridge names Capture sees when it can only observe the container's +// own network namespace. When ALL reported interfaces match this set we assume +// the "no real interfaces visible" case and surface the notice. +const CONTAINER_ONLY_IFACE_NAMES = new Set(["lo", "lo0", "docker0"]); + +const onlyContainerVisibleInterfaces = (checks: HardwareCheckStats[]): boolean => { + const named = new Set(); + checks.forEach((c) => c.net?.forEach((iface) => named.add(iface.name))); + if (named.size === 0) return false; + for (const name of named) { + if (!CONTAINER_ONLY_IFACE_NAMES.has(name)) return false; + } + return true; +}; export const InfraNetworkCharts = ({ checks, @@ -82,7 +92,8 @@ export const InfraNetworkCharts = ({ () => getChartConfigs(theme, checks, t), [theme, checks, t] ); - const showNoTrafficNotice = chartConfigs.length > 0 && !hasAnyNetworkTraffic(checks); + const showNoTrafficNotice = + chartConfigs.length > 0 && onlyContainerVisibleInterfaces(checks); return (