Filter infra traffic at the Hubble agents

Host-originated flows, remote-node, cilium health and DNS :53 were ~74%
of the non-reply events on a 12k-event sample and none of them map to a
workload card; streaming them all kept hubble-relay at ~400m CPU. They
are now blacklisted in the GetFlows request, so agents drop them before
the relay. The UI's "Служебный" toggle had nothing left to show and is
gone; the legend says what isn't collected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Vitaliy Chefanov
2026-09-23 20:26:05 +03:00
co-authored by Claude Opus 5.5
parent 6ead0a0d6d
commit 41f9b47556
4 changed files with 23 additions and 11 deletions
+1 -9
View File
@@ -39,7 +39,6 @@ const CARD = { w: 196, h: 48 };
const PILL = { w: 164, h: 36 };
const NSCARD = { w: 232, h: 56 };
const QUIET_AT = 30; // above this many traffic edges they stay faint until hovered
const INFRA_PREFIXES = ['ext/host/', 'ext/health', 'ext/remote-node'];
const $ = (sel) => document.querySelector(sel);
const el = (tag, props = {}, ...children) => {
@@ -187,7 +186,6 @@ const state = {
filter: '',
traffic: true,
trafficWindow: 300,
infra: false,
flows: null,
flowsError: null,
};
@@ -521,10 +519,6 @@ function scopeNamespaces() {
return [];
}
function isInfraEdge(e) {
if (INFRA_PREFIXES.some((p) => e.source.startsWith(p) || e.target.startsWith(p))) return true;
return e.ports.every((p) => p === '53/UDP' || p === '53/TCP');
}
// Merge per-port flow edges into one edge per pair, for drawing.
function aggregateFlows(flows) {
@@ -569,7 +563,6 @@ function buildElements() {
state.trafficEdges = [];
if (state.traffic && state.flows) {
for (const e of aggregateFlows(state.flows)) {
if (!state.infra && isInfraEdge(e)) continue;
const touches = memberIds.has(e.source) || memberIds.has(e.target);
if (!touches) continue;
for (const id of [e.source, e.target]) {
@@ -622,7 +615,6 @@ async function refreshTraffic() {
const next = new Map();
hiddenPeers = 0;
for (const e of aggregateFlows(flows)) {
if (!state.infra && isInfraEdge(e)) continue;
if (!members.has(e.source) && !members.has(e.target)) continue;
if (cy.getElementById(e.source).empty() || cy.getElementById(e.target).empty()) { hiddenPeers++; continue; }
next.set('tr:' + e.source + '→' + e.target, e);
@@ -940,6 +932,7 @@ function renderLegend() {
el('span', {}, el('span', { class: 'line traffic' }), 'реальный трафик (Hubble)'),
el('span', {}, el('span', { class: 'line drop' }), 'есть drop'),
el('span', {}, 'пунктирная карточка — из другого namespace'),
el('span', {}, 'не собирается: пробы kubelet и трафик с хостов нод, DNS, cilium health'),
);
}
@@ -1126,7 +1119,6 @@ $('#logs-reload').addEventListener('click', loadLogs);
/* ---------- top bar ---------- */
$('#traffic-on').addEventListener('change', (e) => { state.traffic = e.target.checked; renderMap(); });
$('#traffic-window').addEventListener('change', (e) => { state.trafficWindow = Number(e.target.value); if (state.traffic) renderMap(); });
$('#infra-traffic').addEventListener('change', (e) => { state.infra = e.target.checked; renderMap(); });
$('#reload').addEventListener('click', () => load());
matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {