@skyhook-io/radar-app 1.22.2 → 1.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/package.json +8 -8
  2. package/src/App.tsx +35 -10
  3. package/src/RadarApp.basename.test.tsx +177 -0
  4. package/src/RadarApp.settings.test.tsx +33 -0
  5. package/src/api/agentSandbox.ts +259 -0
  6. package/src/api/client.autoPromConnect.test.tsx +43 -0
  7. package/src/api/client.metricsRelayCheck.test.tsx +134 -0
  8. package/src/api/client.ts +122 -24
  9. package/src/api/cloudInstallDiscover.test.tsx +76 -0
  10. package/src/api/diagnose.ts +4 -0
  11. package/src/api/kagent.test.ts +82 -0
  12. package/src/api/kagent.ts +230 -0
  13. package/src/api/prometheusCharts.ts +5 -0
  14. package/src/api/radarFeatures.test.ts +9 -0
  15. package/src/api/radarFeatures.ts +13 -0
  16. package/src/api/substrateWorkspace.test.ts +72 -0
  17. package/src/api/substrateWorkspace.ts +1394 -0
  18. package/src/api/vulnerabilities.ts +207 -9
  19. package/src/api/workloadSource.test.tsx +315 -0
  20. package/src/api/workloadSource.ts +128 -12
  21. package/src/components/CloudConnectFlow.tsx +46 -7
  22. package/src/components/CloudFunnelButton.test.tsx +193 -7
  23. package/src/components/CloudFunnelButton.tsx +127 -32
  24. package/src/components/SelfManagedStart.tsx +12 -2
  25. package/src/components/agentsandbox/AgentSandboxKindLists.tsx +41 -0
  26. package/src/components/agentsandbox/AgentSandboxLists.test.tsx +410 -0
  27. package/src/components/agentsandbox/AgentSandboxOverview.test.tsx +333 -0
  28. package/src/components/agentsandbox/AgentSandboxOverview.tsx +555 -0
  29. package/src/components/agentsandbox/AgentSandboxSidebar.test.tsx +97 -0
  30. package/src/components/agentsandbox/AgentSandboxSummary.test.tsx +439 -0
  31. package/src/components/agentsandbox/AgentSandboxSummary.tsx +956 -0
  32. package/src/components/agentsandbox/AgentSandboxTables.tsx +966 -0
  33. package/src/components/agentsandbox/AgentSandboxView.tsx +34 -0
  34. package/src/components/agentsandbox/agentsandbox.fixtures.ts +135 -0
  35. package/src/components/agentsandbox/data.ts +135 -0
  36. package/src/components/agentsandbox/host.test.ts +27 -0
  37. package/src/components/agentsandbox/host.tsx +85 -0
  38. package/src/components/agentsandbox/labels.test.ts +42 -0
  39. package/src/components/agentsandbox/labels.ts +146 -0
  40. package/src/components/agentsandbox/listFilters.ts +85 -0
  41. package/src/components/agentsandbox/lists.ts +52 -0
  42. package/src/components/agentsandbox/routes.ts +23 -0
  43. package/src/components/agentsandbox/shared.tsx +321 -0
  44. package/src/components/agentsandbox/useAgentSandboxSidebarWorkspace.ts +69 -0
  45. package/src/components/agentsandbox/workspace.fixtures.ts +125 -0
  46. package/src/components/agentsandbox/workspace.tsx +258 -0
  47. package/src/components/agentsandbox/workspaceRoute.ts +18 -0
  48. package/src/components/applications/ApplicationsView.openResource.test.tsx +248 -3
  49. package/src/components/applications/ApplicationsView.tsx +156 -3
  50. package/src/components/audit/VulnerabilitiesColumns.test.tsx +487 -0
  51. package/src/components/audit/VulnerabilitiesRisk.test.tsx +318 -0
  52. package/src/components/audit/VulnerabilitiesView.test.tsx +458 -13
  53. package/src/components/audit/VulnerabilitiesView.tsx +639 -199
  54. package/src/components/cloudHints/AgentSetupCloudRow.tsx +28 -0
  55. package/src/components/cloudHints/CloudHintLink.tsx +29 -0
  56. package/src/components/cloudHints/SharedInstallAiLine.tsx +36 -0
  57. package/src/components/cloudHints/cloudHints.test.ts +126 -0
  58. package/src/components/cloudHints/cloudHints.ts +131 -0
  59. package/src/components/cloudHints/cloudHintsGate.test.tsx +70 -0
  60. package/src/components/cloudHints/cloudLinks.test.ts +52 -0
  61. package/src/components/cloudHints/cloudLinks.ts +31 -0
  62. package/src/components/cloudHints/hintStorage.ts +28 -0
  63. package/src/components/cnpg/CNPGView.tsx +4 -7
  64. package/src/components/diagnose/AgentSetupNotice.tsx +5 -0
  65. package/src/components/diagnose/DiagnoseContext.tsx +7 -0
  66. package/src/components/diagnose/DiagnoseSurface.escape.test.tsx +215 -0
  67. package/src/components/diagnose/DiagnoseSurface.tsx +57 -1
  68. package/src/components/gitops/RemoteDestinationCloudHint.tsx +6 -14
  69. package/src/components/home/HomeAgentBlock.tsx +2 -0
  70. package/src/components/home/HomeView.tsx +3 -3
  71. package/src/components/home/MCPSetupDialog.test.tsx +9 -0
  72. package/src/components/home/MCPSetupDialog.tsx +6 -2
  73. package/src/components/home/McpCloudLine.test.tsx +162 -0
  74. package/src/components/home/McpCloudLine.tsx +95 -0
  75. package/src/components/home/ProblemsPanel.investigate.test.tsx +2 -2
  76. package/src/components/home/mcpToolCatalog.test.ts +10 -0
  77. package/src/components/home/mcpToolCatalog.ts +4 -4
  78. package/src/components/issues/ClusterSchedulingBlockerRow.tsx +35 -0
  79. package/src/components/issues/IssuesPane.render.test.tsx +36 -1
  80. package/src/components/issues/IssuesPane.tsx +181 -23
  81. package/src/components/issues/SinceLastVisitRow.render.test.tsx +302 -0
  82. package/src/components/issues/SinceLastVisitRow.tsx +71 -0
  83. package/src/components/issues/sinceLastVisit.test.ts +266 -0
  84. package/src/components/issues/sinceLastVisit.ts +439 -0
  85. package/src/components/kagent/KagentAgentRenderer.test.ts +32 -0
  86. package/src/components/kagent/KagentAgentRenderer.tsx +87 -0
  87. package/src/components/kagent/KagentAgentSessions.test.tsx +166 -0
  88. package/src/components/kagent/KagentAgentSessions.tsx +124 -0
  89. package/src/components/kagent/KagentDetailPage.tsx +106 -0
  90. package/src/components/kagent/KagentLists.tsx +412 -0
  91. package/src/components/kagent/KagentOverview.tsx +234 -0
  92. package/src/components/kagent/KagentPages.tsx +690 -0
  93. package/src/components/kagent/KagentRuntimeTabs.test.tsx +219 -0
  94. package/src/components/kagent/KagentRuntimeTabs.tsx +283 -0
  95. package/src/components/kagent/KagentSidebar.test.tsx +112 -0
  96. package/src/components/kagent/KagentView.tsx +109 -0
  97. package/src/components/kagent/KagentWorkspace.test.tsx +876 -0
  98. package/src/components/kagent/host.tsx +144 -0
  99. package/src/components/kagent/routes.ts +31 -0
  100. package/src/components/kagent/shared.tsx +336 -0
  101. package/src/components/kagent/useKagentRuntime.test.tsx +77 -0
  102. package/src/components/kagent/useKagentSidebarWorkspace.ts +67 -0
  103. package/src/components/kagent/workspace.fixtures.ts +108 -0
  104. package/src/components/kagent/workspaceRoute.ts +18 -0
  105. package/src/components/resource/MetricsNotConnected.test.tsx +28 -0
  106. package/src/components/resource/MetricsNotConnected.tsx +10 -7
  107. package/src/components/resource/PrometheusCharts.tsx +10 -1
  108. package/src/components/resource/PrometheusChartsGrid.render.test.tsx +9 -0
  109. package/src/components/resource/PrometheusChartsGrid.tsx +3 -3
  110. package/src/components/resource/SubstrateHealthCharts.test.tsx +13 -1
  111. package/src/components/resource/SubstrateHealthCharts.tsx +9 -15
  112. package/src/components/resources/ResourceDetailDrawer.tsx +1 -0
  113. package/src/components/resources/ResourcesView.tsx +2 -6
  114. package/src/components/resources/renderers/PodRenderer.tsx +8 -2
  115. package/src/components/settings/LocalIntegrationStatus.test.tsx +1 -0
  116. package/src/components/settings/LocalIntegrationStatus.tsx +3 -2
  117. package/src/components/settings/SettingsDialog.tsx +84 -16
  118. package/src/components/settings/SubstrateSettings.lifecycle.test.tsx +210 -0
  119. package/src/components/settings/SubstrateSettings.test.tsx +131 -0
  120. package/src/components/settings/SubstrateSettings.tsx +544 -0
  121. package/src/components/settings/settings-state.test.ts +21 -3
  122. package/src/components/settings/settings-state.ts +13 -3
  123. package/src/components/share/ShareLinkButton.test.tsx +360 -0
  124. package/src/components/share/ShareLinkButton.tsx +391 -0
  125. package/src/components/share/openShareInCloud.test.ts +29 -0
  126. package/src/components/share/openShareInCloud.ts +10 -0
  127. package/src/components/share/shareLink.test.ts +129 -0
  128. package/src/components/share/shareLink.ts +175 -0
  129. package/src/components/substrate/SubstrateActorDrawer.tsx +87 -0
  130. package/src/components/substrate/SubstrateActorOverview.tsx +489 -0
  131. package/src/components/substrate/SubstrateActorPage.tsx +384 -0
  132. package/src/components/substrate/SubstrateActors.test.tsx +1094 -0
  133. package/src/components/substrate/SubstrateActors.tsx +612 -0
  134. package/src/components/substrate/SubstrateAttentionList.tsx +441 -0
  135. package/src/components/substrate/SubstrateConnect.tsx +88 -0
  136. package/src/components/substrate/SubstrateOverview.test.tsx +396 -0
  137. package/src/components/substrate/SubstrateOverview.tsx +575 -0
  138. package/src/components/substrate/SubstratePages.test.tsx +478 -0
  139. package/src/components/substrate/SubstratePool.test.tsx +462 -0
  140. package/src/components/substrate/SubstratePoolPage.tsx +95 -0
  141. package/src/components/substrate/SubstratePoolSummary.tsx +485 -0
  142. package/src/components/substrate/SubstrateSidebar.test.tsx +101 -0
  143. package/src/components/substrate/SubstrateStateBar.tsx +63 -0
  144. package/src/components/substrate/SubstrateTemplates.tsx +376 -0
  145. package/src/components/substrate/SubstrateView.tsx +173 -0
  146. package/src/components/substrate/SubstrateWorkerPodContext.tsx +73 -0
  147. package/src/components/substrate/SubstrateWorkers.tsx +389 -0
  148. package/src/components/substrate/attention.ts +81 -0
  149. package/src/components/substrate/contextPin.tsx +69 -0
  150. package/src/components/substrate/host.tsx +83 -0
  151. package/src/components/substrate/kubectlTarget.test.tsx +77 -0
  152. package/src/components/substrate/readings.test.ts +484 -0
  153. package/src/components/substrate/readings.ts +997 -0
  154. package/src/components/substrate/routes.ts +103 -0
  155. package/src/components/substrate/shared.tsx +426 -0
  156. package/src/components/substrate/substrate.fixtures.ts +325 -0
  157. package/src/components/substrate/useSubstrateSidebarWorkspace.ts +87 -0
  158. package/src/components/substrate/workspaceRoute.ts +23 -0
  159. package/src/components/traffic/TrafficConnectionsTable.test.tsx +9 -0
  160. package/src/components/traffic/TrafficConnectionsTable.tsx +4 -2
  161. package/src/components/traffic/TrafficFilterSidebar.tsx +19 -14
  162. package/src/components/traffic/TrafficFlowList.test.tsx +63 -0
  163. package/src/components/traffic/TrafficFlowList.tsx +9 -5
  164. package/src/components/traffic/TrafficGraph.test.tsx +26 -0
  165. package/src/components/traffic/TrafficGraph.tsx +17 -14
  166. package/src/components/traffic/TrafficGraphTooLarge.tsx +2 -0
  167. package/src/components/traffic/TrafficGraphUnavailable.tsx +3 -1
  168. package/src/components/traffic/TrafficView.tsx +26 -56
  169. package/src/components/traffic/trafficFilters.test.ts +61 -1
  170. package/src/components/traffic/trafficFilters.ts +68 -8
  171. package/src/components/velero/VeleroOverview.tsx +2 -2
  172. package/src/components/velero/VeleroView.tsx +3 -6
  173. package/src/components/vulnerabilities/columns.tsx +132 -0
  174. package/src/components/vulnerabilities/filters.tsx +317 -0
  175. package/src/components/vulnerabilities/owner.test.ts +54 -0
  176. package/src/components/vulnerabilities/owner.tsx +163 -0
  177. package/src/components/vulnerabilities/parts.test.ts +126 -12
  178. package/src/components/vulnerabilities/parts.tsx +612 -52
  179. package/src/components/vulnerabilities/traffic.test.tsx +65 -0
  180. package/src/components/vulnerabilities/traffic.tsx +40 -0
  181. package/src/components/workload/WorkloadView.substrateVersion.test.tsx +88 -0
  182. package/src/components/workload/WorkloadView.tsx +52 -13
  183. package/src/components/workspace/layout.tsx +13 -7
  184. package/src/components/workspace/sidebar.test.ts +48 -0
  185. package/src/components/workspace/sidebar.ts +73 -3
  186. package/src/components/workspace/table.ts +2 -1
  187. package/src/contexts/RegistryAccessMode.test.tsx +51 -0
  188. package/src/contexts/RegistryAccessMode.tsx +25 -0
  189. package/src/integrations/resourceHost.ts +12 -6
  190. package/src/integrations/resourceHosts.test.tsx +27 -1
  191. package/src/integrations/resourceHosts.tsx +15 -7
  192. package/src/integrations/sidebarWorkspaces.test.tsx +63 -0
  193. package/src/integrations/sidebarWorkspaces.ts +41 -0
  194. package/src/integrations/workspaceRoute.ts +1 -1
  195. package/src/integrations/workspaceRoutes.ts +7 -1
  196. package/src/integrations/workspaceScreens.tsx +6 -0
@@ -243,6 +243,32 @@ describe('TrafficGraph edge labels for traffic measured only in bytes', () => {
243
243
  expect(httpLabel).toBe('HTTP · 1.9/s')
244
244
  })
245
245
 
246
+ it('labels Caretta bytes-only edges with throughput and omits Connections: 0 in details', async () => {
247
+ await act(async () => root.render(<TrafficGraph flows={[tcpOnly]} trafficSource="caretta" onLayoutUnavailable={vi.fn()} windowSeconds={60} />))
248
+ const edge = container.querySelector<HTMLButtonElement>('[data-edge="demo/httpbin->demo/curl:0"]')!
249
+ expect(edge.textContent).toBe('TCP · 2.4 KB/s')
250
+ act(() => edge.click())
251
+ expect(container.textContent).toContain('Data')
252
+ expect(container.textContent).not.toContain('Connections')
253
+ })
254
+
255
+ it('relabels the same flows when the source switches to Caretta', async () => {
256
+ const flows = [tcpOnly]
257
+ await act(async () => root.render(<TrafficGraph flows={flows} trafficSource="hubble" onLayoutUnavailable={vi.fn()} windowSeconds={60} />))
258
+ const edge = () => container.querySelector<HTMLButtonElement>('[data-edge="demo/httpbin->demo/curl:0"]')!
259
+ expect(edge().textContent).not.toContain('KB/s')
260
+ await act(async () => root.render(<TrafficGraph flows={flows} trafficSource="caretta" onLayoutUnavailable={vi.fn()} windowSeconds={60} />))
261
+ expect(edge().textContent).toBe('TCP · 2.4 KB/s')
262
+ })
263
+
264
+ it('shows no count beside a Caretta node protocol, only the data it moved', async () => {
265
+ await act(async () => root.render(<TrafficGraph flows={[tcpOnly]} trafficSource="caretta" onLayoutUnavailable={vi.fn()} windowSeconds={60} />))
266
+ act(() => container.querySelector<HTMLButtonElement>('[data-node="demo/httpbin"]')!.click())
267
+ const protocols = Array.from(container.querySelectorAll('div')).find(el => el.textContent === 'Protocols')!.parentElement!
268
+ expect(protocols.textContent).toBe('ProtocolsTCP')
269
+ expect(container.textContent).toContain('Data transferred')
270
+ })
271
+
246
272
  it('claims no throughput for an older Radar whose byte sum can mix TCP and UDP', async () => {
247
273
  const legacyTcp = { ...incoming, bytesByProtocol: undefined, bytesSent: 300, bytesRecv: 0 }
248
274
  const legacyUdp = { ...incoming, protocol: 'udp', bytesByProtocol: undefined, bytesSent: 600, bytesRecv: 0 }
@@ -26,7 +26,7 @@ import { getNamespaceColor } from '../../utils/traffic-colors'
26
26
  import { Tooltip } from '../ui/Tooltip'
27
27
  import { TrafficData } from './TrafficData'
28
28
  import { describeTrafficNode } from './traffic-export'
29
- import { dataByProtocol, protocolsOf, throughputLabel, totalDataByProtocol, protocolName, isRateBasedSource, isExternalKind, requestRateOf, errorRateOf, formatRate, formatConnections, formatVolume, MAX_VISIBLE_PORTS, displayVolume, latencyWeightOf, edgesOnPort, protocolLabel, portLabel, type TrafficFocus } from './trafficFilters'
29
+ import { dataByProtocol, protocolsOf, throughputLabel, totalDataByProtocol, protocolName, isRateBasedSource, reportsVolumeCounts, isExternalKind, requestRateOf, errorRateOf, formatRate, formatConnections, formatVolume, MAX_VISIBLE_PORTS, displayVolume, latencyWeightOf, edgesOnPort, protocolLabel, portLabel, type TrafficFocus } from './trafficFilters'
30
30
 
31
31
  // ELK is 1.5 MB; load it with the first traffic layout, not with the app.
32
32
  let elkPromise: Promise<ELK> | null = null
@@ -449,6 +449,7 @@ function DetailsPanel({
449
449
  onFocus,
450
450
  flows,
451
451
  isRateBased,
452
+ hasVolumeCounts,
452
453
  }: {
453
454
  selection: Selection
454
455
  onClose: () => void
@@ -457,6 +458,7 @@ function DetailsPanel({
457
458
  // True for sources that measure a rate rather than counting connections —
458
459
  // Istio and Beyla both do. Changes the wording and the /s suffix.
459
460
  isRateBased: boolean
461
+ hasVolumeCounts: boolean
460
462
  }) {
461
463
  if (!selection) return null
462
464
 
@@ -680,7 +682,7 @@ function DetailsPanel({
680
682
  .map(([proto, count]) => (
681
683
  <span key={proto} className="inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-theme-bg text-theme-text-secondary">
682
684
  <span className="font-medium">{proto}</span>
683
- {!(isRateBased && !count) && <span className="text-theme-text-tertiary">{formatVolume(count, isRateBased)}{isRateBased ? '/s' : ''}</span>}
685
+ {!((isRateBased || !hasVolumeCounts) && !count) &&<span className="text-theme-text-tertiary">{formatVolume(count, isRateBased)}{isRateBased ? '/s' : ''}</span>}
684
686
  </span>
685
687
  ))}
686
688
  </div>
@@ -875,10 +877,10 @@ function DetailsPanel({
875
877
  : protocolLabel(edgeData.flow?.l7Protocol && protocolName(edgeData.flow.l7Protocol), protocolName(edgeData.protocol))}
876
878
  </div>
877
879
  </div>
878
- {(!isRateBased || edgeData.connections > 0) && (
879
- // A rate-based source reports no request rate for traffic with no
880
- // HTTP, and "0/s" beside a data figure in megabytes reads as "no
881
- // traffic" rather than "not measured".
880
+ {(edgeData.connections > 0 || (!isRateBased && !(edgeData.flow && (edgeData.flow.bytesSent > 0 || edgeData.flow.bytesRecv > 0)))) && (
881
+ // Rate-based sources and bytes-only sources (like Caretta) report
882
+ // no count here; showing "0" beside megabytes of Data reads as no
883
+ // traffic rather than unmeasured count.
882
884
  <div className="p-2 rounded bg-theme-elevated">
883
885
  <div className="text-theme-text-tertiary">{isRateBased ? 'Request Rate' : 'Connections'}</div>
884
886
  <div className="text-theme-text-primary font-medium">
@@ -1162,6 +1164,7 @@ export function TrafficGraph({ flows, hotPathThreshold = 0, showNamespaceGroups
1162
1164
  // Beyla is rate-based too: its Connections field carries requests per second,
1163
1165
  // not a connection count, so it needs the same label Istio gets.
1164
1166
  const isRateBased = isRateBasedSource(trafficSource)
1167
+ const hasVolumeCounts = reportsVolumeCounts(trafficSource)
1165
1168
  const connLabel = isRateBased ? 'req/s' : 'conn'
1166
1169
  const [layoutedNodes, setLayoutedNodes] = useState<Node<TrafficNodeData>[]>([])
1167
1170
  const [layoutedEdges, setLayoutedEdges] = useState<Edge[]>([])
@@ -1405,10 +1408,9 @@ export function TrafficGraph({ flows, hotPathThreshold = 0, showNamespaceGroups
1405
1408
  const errorLabel = hasErrors
1406
1409
  ? ` · ${isRateBased ? `${formatRate(errorRateOf(flow))} err/s` : `${formatConnections(flow.errorCount ?? 0)} err`}`
1407
1410
  : ''
1408
- // A source that measures rates has no count for an edge with no requests on
1409
- // it — a plain TCP conversation, or one whose direction is unknown. Printing
1410
- // "0/s" there reads as no traffic, on an edge that may be carrying megabytes.
1411
- const bytesOnly = isRateBased && !flow.connections
1411
+ // Sources that measure only bytes on TCP edges (Istio TCP, Beyla TCP,
1412
+ // Caretta) report connections=0; draw throughput rather than "0".
1413
+ const bytesOnly = !flow.connections && (isRateBased || !hasVolumeCounts)
1412
1414
  const countLabel = bytesOnly ? '' : connStr
1413
1415
  const throughput = bytesOnly ? throughputLabel(flow, windowSeconds) : ''
1414
1416
  const edgeLabel = [throughput || l7Label + countLabel, latencyLabel, errorLabel]
@@ -1465,7 +1467,7 @@ export function TrafficGraph({ flows, hotPathThreshold = 0, showNamespaceGroups
1465
1467
  addonGroupEdge, // Pass this for adding after group is created
1466
1468
  addonGroupOutEdge, // Pass this for adding group → kubernetes edge
1467
1469
  }
1468
- }, [flows, hotPathThreshold, showNamespaceGroups, serviceCategories, addonMode, isRateBased, connLabel, windowSeconds])
1470
+ }, [flows, hotPathThreshold, showNamespaceGroups, serviceCategories, addonMode, isRateBased, hasVolumeCounts, connLabel, windowSeconds])
1469
1471
 
1470
1472
  // Apply ELK layout
1471
1473
  const applyLayout = useCallback(async (claim: () => boolean) => {
@@ -1604,7 +1606,7 @@ export function TrafficGraph({ flows, hotPathThreshold = 0, showNamespaceGroups
1604
1606
  target: 'addon-group',
1605
1607
  type: 'smoothstep',
1606
1608
  animated: isHotEdge,
1607
- label: isRateBased && !connections ? throughputLabel(groupFlow, windowSeconds) : isRateBased ? `${formatRate(displayVolume(groupFlow, isRateBased))}/s` : formatConnections(connections),
1609
+ label: (isRateBased || !hasVolumeCounts) && !connections ? throughputLabel(groupFlow, windowSeconds) : isRateBased ? `${formatRate(displayVolume(groupFlow, isRateBased))}/s` : formatConnections(connections),
1608
1610
  labelBgStyle: {
1609
1611
  fill: '#581c87', // purple-900
1610
1612
  fillOpacity: 0.9,
@@ -1638,7 +1640,7 @@ export function TrafficGraph({ flows, hotPathThreshold = 0, showNamespaceGroups
1638
1640
  target: targetId,
1639
1641
  type: 'smoothstep',
1640
1642
  animated: isHotEdge,
1641
- label: isRateBased && !connections ? throughputLabel(groupFlow, windowSeconds) : isRateBased ? `${formatRate(displayVolume(groupFlow, isRateBased))}/s` : formatConnections(connections),
1643
+ label: (isRateBased || !hasVolumeCounts) && !connections ? throughputLabel(groupFlow, windowSeconds) : isRateBased ? `${formatRate(displayVolume(groupFlow, isRateBased))}/s` : formatConnections(connections),
1642
1644
  labelBgStyle: {
1643
1645
  fill: '#581c87', // purple-900
1644
1646
  fillOpacity: 0.9,
@@ -1680,7 +1682,7 @@ export function TrafficGraph({ flows, hotPathThreshold = 0, showNamespaceGroups
1680
1682
  setLayoutedEdges(rawEdges)
1681
1683
  setElkUnavailable(false)
1682
1684
  }
1683
- }, [rawNodes, rawEdges, addonMode, addonGroupEdge, addonGroupOutEdge, hotPathThreshold, isRateBased, windowSeconds])
1685
+ }, [rawNodes, rawEdges, addonMode, addonGroupEdge, addonGroupOutEdge, hotPathThreshold, isRateBased, hasVolumeCounts, windowSeconds])
1684
1686
 
1685
1687
  // Run layout when flows change. Runs install their results in the order
1686
1688
  // they started, so a fast-changing graph still lands each layout instead of
@@ -1842,6 +1844,7 @@ export function TrafficGraph({ flows, hotPathThreshold = 0, showNamespaceGroups
1842
1844
  : undefined}
1843
1845
  flows={flows}
1844
1846
  isRateBased={isRateBased}
1847
+ hasVolumeCounts={hasVolumeCounts}
1845
1848
  />
1846
1849
  )}
1847
1850
  </div>
@@ -25,6 +25,7 @@ interface TrafficGraphTooLargeProps {
25
25
  endpoints: EndpointSummary[]
26
26
  onFocus: (focus: TrafficFocus) => void
27
27
  isRateBased: boolean
28
+ hasVolumeCounts?: boolean
28
29
  overlayContainer?: HTMLElement | null
29
30
  flows: AggregatedFlow[]
30
31
  selection: TrafficGraphSelection | null
@@ -139,6 +140,7 @@ export function TrafficGraphTooLarge(props: TrafficGraphTooLargeProps) {
139
140
  <TrafficConnectionsTable
140
141
  flows={props.flows}
141
142
  isRateBased={isRateBased}
143
+ hasVolumeCounts={props.hasVolumeCounts}
142
144
  selection={props.selection}
143
145
  onSelect={props.onSelect}
144
146
  onFocus={onFocus}
@@ -10,6 +10,7 @@ interface TrafficGraphUnavailableProps {
10
10
  /** The view's connections as they are, before addons are grouped for drawing. */
11
11
  flows: AggregatedFlow[]
12
12
  isRateBased: boolean
13
+ hasVolumeCounts?: boolean
13
14
  selection: TrafficGraphSelection | null
14
15
  onSelect: (selection: TrafficGraphSelection | null) => void
15
16
  onFocus: (focus: TrafficFocus) => void
@@ -23,7 +24,7 @@ interface TrafficGraphUnavailableProps {
23
24
  * what a tab opened before an upgrade gets: says so, offers the reload that
24
25
  * fixes it, and lists the connections so the view still answers something.
25
26
  */
26
- export function TrafficGraphUnavailable({ flows, isRateBased, selection, onSelect, onFocus, focusedId, notice }: TrafficGraphUnavailableProps) {
27
+ export function TrafficGraphUnavailable({ flows, isRateBased, hasVolumeCounts, selection, onSelect, onFocus, focusedId, notice }: TrafficGraphUnavailableProps) {
27
28
  return (
28
29
  <div className="absolute inset-x-0 bottom-0 top-12 flex flex-col px-3 pb-3 gap-2">
29
30
  {notice}
@@ -46,6 +47,7 @@ export function TrafficGraphUnavailable({ flows, isRateBased, selection, onSelec
46
47
  <TrafficConnectionsTable
47
48
  flows={flows}
48
49
  isRateBased={isRateBased}
50
+ hasVolumeCounts={hasVolumeCounts}
49
51
  selection={selection}
50
52
  onSelect={onSelect}
51
53
  onFocus={onFocus}
@@ -20,15 +20,21 @@ import { useDesktopBlobDownload } from '../../hooks/useDesktopDownload'
20
20
  import { Tooltip } from '../ui/Tooltip'
21
21
  import { SEVERITY_TEXT } from '@skyhook-io/k8s-ui/utils/badge-colors'
22
22
  import { DURATION_DOCK } from '@skyhook-io/k8s-ui/utils/animation'
23
- import { matchesStatusRanges, bucketsFromCounts, bucketsFromStatus, isRateBasedSource, keepAvailable, effectiveThreshold, volumeUnit, type VolumeUnit, isExternalKind, groupAddonFlows, mergeFlowVolume, coverageLabel, type GraphFlow, endpointPair, graphEndpoint, graphEndpointId, mergeRawPairs, mergeEdgePortInto, selectedEdgeMatcher, selectionRawPairs, selectionMatch, graphSize, GRAPH_DRAW_BUDGET, GRAPH_DRAW_CEILING, parseFocus, focusParam, focusId, focusNeighborhood, touchesFocus, endpointSummaries, namespaceSummaries, verdictChoices, type TrafficFocus, warningRetries, warningBannerTitle, emptyWarningHeadline, rateWindowSeconds } from './trafficFilters'
23
+ import { matchesStatusRanges, bucketsFromCounts, bucketsFromStatus, isRateBasedSource, reportsVolumeCounts, keepAvailable, effectiveThreshold, volumeUnit, type VolumeUnit, isExternalKind, groupAddonFlows, mergeFlowVolume, collapseInternetFlows, coverageLabel, type GraphFlow, endpointPair, graphEndpoint, graphEndpointId, mergeRawPairs, mergeEdgePortInto, selectedEdgeMatcher, selectionRawPairs, selectionMatch, graphSize, GRAPH_DRAW_BUDGET, GRAPH_DRAW_CEILING, parseFocus, focusParam, focusId, focusNeighborhood, touchesFocus, endpointSummaries, namespaceSummaries, verdictChoices, type TrafficFocus, warningRetries, warningBannerTitle, emptyWarningHeadline, rateWindowSeconds } from './trafficFilters'
24
24
 
25
25
  // Where a warning about which cluster the traffic belongs to points: how the map
26
26
  // keeps to this cluster in a shared metrics store, and how to set its label.
27
27
  const CLUSTER_SCOPE_DOCS_URL = 'https://github.com/skyhook-io/radar/blob/main/docs/configuration.md#traffic-map-in-a-shared-metrics-store'
28
28
 
29
- function ClusterScopeDocsLink() {
29
+ // The docs a flows warning points to: the source's own, else the cluster-scope
30
+ // docs when the warning is about which cluster the traffic belongs to.
31
+ function flowsWarningDocsUrl(data: { warningDocsUrl?: string; warningClusterScope?: boolean } | undefined): string | undefined {
32
+ return data?.warningDocsUrl || (data?.warningClusterScope ? CLUSTER_SCOPE_DOCS_URL : undefined)
33
+ }
34
+
35
+ function WarningDocsLink({ href }: { href: string }) {
30
36
  return (
31
- <a className="text-xs text-accent hover:underline" href={CLUSTER_SCOPE_DOCS_URL} target="_blank" rel="noopener noreferrer">
37
+ <a className="text-xs text-accent hover:underline" href={href} target="_blank" rel="noopener noreferrer">
32
38
  How to fix this
33
39
  </a>
34
40
  )
@@ -540,12 +546,13 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
540
546
  // a hiccup, so retrying it is all cost and no progress.
541
547
  const warningRetriable = warningRetries(flowsData?.warningKind)
542
548
  const coverage = coverageLabel(flowsData?.coveredSince, flowsData?.timestamp)
549
+ const warningDocsHref = flowsWarningDocsUrl(flowsData)
543
550
  const flowsWarning = flowsData?.warning ? (
544
551
  <AlertBanner
545
552
  variant="warning"
546
553
  title={warningBannerTitle(flowsData.warningKind)}
547
554
  message={flowsData.warning}
548
- action={flowsData.warningClusterScope ? <ClusterScopeDocsLink /> : undefined}
555
+ action={warningDocsHref ? <WarningDocsLink href={warningDocsHref} /> : undefined}
549
556
  />
550
557
  ) : null
551
558
 
@@ -582,6 +589,8 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
582
589
  }, [flowsData?.aggregated])
583
590
 
584
591
  const isRateBased = isRateBasedSource(sourcesData?.active)
592
+ // A count threshold would hide every edge of a source that reports no counts.
593
+ const hasVolumeCounts = reportsVolumeCounts(sourcesData?.active)
585
594
 
586
595
  // Which L7 filters can return something, so the sidebar never offers a control
587
596
  // that matches nothing. Sources differ in what they can report: a rate-based one
@@ -627,7 +636,7 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
627
636
  () => keepAvailable(verdicts, l7Capabilities.availableVerdicts),
628
637
  [verdicts, l7Capabilities.availableVerdicts])
629
638
  const activeDnsPattern = l7Capabilities.hasDNSQueries ? dnsPattern : ''
630
- const activeMinConnections = effectiveThreshold(minConnections, minConnectionsUnit, volumeUnit(isRateBased))
639
+ const activeMinConnections = hasVolumeCounts ? effectiveThreshold(minConnections, minConnectionsUnit, volumeUnit(isRateBased)) : 0
631
640
 
632
641
  const hasOverlayFlows = useMemo(() => !!flowsData?.aggregated?.some(f => f.likelyOverlay), [flowsData?.aggregated])
633
642
 
@@ -898,51 +907,9 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
898
907
  }, [graphInputFlows, aggregateExternal, detectServices])
899
908
 
900
909
  // Collapse inbound internet traffic (external sources → internal destinations)
901
- const internetCollapsedFlows = useMemo<GraphFlow[]>(() => {
902
- if (!collapseInternet) return processedFlows
903
-
904
- // Group flows where external sources connect to internal destinations
905
- const internetFlowsMap = new Map<string, GraphFlow>() // destKey -> aggregated flow
906
- const nonInternetFlows: GraphFlow[] = []
907
-
908
- processedFlows.forEach(flow => {
909
- const sourceIsExternal = isExternal(flow.source.kind)
910
- const destIsInternal = !isExternal(flow.destination.kind)
911
-
912
- // Only collapse external → internal flows (inbound internet traffic)
913
- if (sourceIsExternal && destIsInternal) {
914
- // Key on destination + port, and on whether the direction is known: this
915
- // collapse merges genuinely different external clients, so one of them
916
- // arriving unoriented must not take the arrowhead off another's traffic.
917
- const orientation = flow.directionUnknown ? '|u' : '|o'
918
- const destKey = flow.destination.namespace
919
- ? `${flow.destination.namespace}/${flow.destination.name}:${flow.port}${orientation}`
920
- : `${flow.destination.name}:${flow.port}${orientation}`
921
-
922
- const existing = internetFlowsMap.get(destKey)
923
- if (existing) {
924
- mergeFlowVolume(existing, flow)
925
- mergeRawPairs(existing, flow)
926
- mergeEdgePortInto(existing, flow)
927
- } else {
928
- // Create new "Internet" → destination flow
929
- internetFlowsMap.set(destKey, {
930
- ...flow,
931
- rawPairs: [...(flow.rawPairs ?? [])],
932
- source: {
933
- name: 'Internet',
934
- namespace: '',
935
- kind: 'Internet',
936
- },
937
- })
938
- }
939
- } else {
940
- nonInternetFlows.push(flow)
941
- }
942
- })
943
-
944
- return [...nonInternetFlows, ...Array.from(internetFlowsMap.values())]
945
- }, [processedFlows, collapseInternet])
910
+ const internetCollapsedFlows = useMemo<GraphFlow[]>(
911
+ () => (collapseInternet ? collapseInternetFlows(processedFlows) : processedFlows),
912
+ [processedFlows, collapseInternet])
946
913
 
947
914
  // When grouping addons:
948
915
  // 1. Aggregate internet → addon into single edge to group
@@ -1374,6 +1341,7 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
1374
1341
  hasDNSQueries={l7Capabilities.hasDNSQueries}
1375
1342
  availableHTTPMethods={l7Capabilities.availableHTTPMethods}
1376
1343
  isRateBased={isRateBased}
1344
+ hideVolumeFilter={!hasVolumeCounts}
1377
1345
  l7Protocol={l7Protocol}
1378
1346
  setL7Protocol={setL7Protocol}
1379
1347
  l7Methods={l7Methods}
@@ -1561,6 +1529,7 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
1561
1529
  endpoints={focusableEndpoints}
1562
1530
  onFocus={setFocus}
1563
1531
  isRateBased={isRateBased}
1532
+ hasVolumeCounts={hasVolumeCounts}
1564
1533
  overlayContainer={graphPaneRef.current}
1565
1534
  flows={focusedFlows}
1566
1535
  selection={graphSelection}
@@ -1574,6 +1543,7 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
1574
1543
  <TrafficGraphUnavailable
1575
1544
  flows={focusedFlows}
1576
1545
  isRateBased={isRateBased}
1546
+ hasVolumeCounts={hasVolumeCounts}
1577
1547
  selection={graphSelection}
1578
1548
  onSelect={setGraphSelection}
1579
1549
  onFocus={setFocus}
@@ -1612,7 +1582,7 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
1612
1582
  onShowSystem={() => setHideSystem(false)}
1613
1583
  onSwitchNamespace={onSetNamespaces && !namespaceLocked && focus.namespace ? () => onSetNamespaces([focus.namespace!]) : undefined}
1614
1584
  warning={flowsData.warning}
1615
- warningClusterScope={flowsData.warningClusterScope}
1585
+ warningDocsUrl={warningDocsHref}
1616
1586
  onLeave={() => setFocus(null)}
1617
1587
  />
1618
1588
  </div>
@@ -1663,7 +1633,7 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
1663
1633
  icon={AlertTriangle}
1664
1634
  headline={emptyWarningHeadline(flowsData.warningKind)}
1665
1635
  body={flowsData.warning}
1666
- action={flowsData.warningClusterScope ? <ClusterScopeDocsLink /> : undefined}
1636
+ action={warningDocsHref ? <WarningDocsLink href={warningDocsHref} /> : undefined}
1667
1637
  className="max-w-md"
1668
1638
  />
1669
1639
  ) : (
@@ -1693,14 +1663,14 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
1693
1663
  * one of them means the workload is quiet: Radar may have hidden its traffic,
1694
1664
  * or never fetched it.
1695
1665
  */
1696
- function FocusNotFound({ focus, hiddenByFilters, systemHidden, hideSystem, outsideNamespaces, window, onShowAll, onShowSystem, onSwitchNamespace, warning, warningClusterScope, onLeave }: {
1666
+ function FocusNotFound({ focus, hiddenByFilters, systemHidden, hideSystem, outsideNamespaces, window, onShowAll, onShowSystem, onSwitchNamespace, warning, warningDocsUrl, onLeave }: {
1697
1667
  focus: TrafficFocus
1698
1668
  /** Hide System is on: traffic with system namespaces was never fetched. */
1699
1669
  hideSystem: boolean
1700
1670
  /** The fetch's own warning: with it, absence is not proof of quiet. */
1701
1671
  warning?: string
1702
- /** The warning is about which cluster the traffic belongs to. */
1703
- warningClusterScope?: boolean
1672
+ /** Docs that explain how to fix what the warning describes. */
1673
+ warningDocsUrl?: string
1704
1674
  hiddenByFilters: boolean
1705
1675
  systemHidden: boolean
1706
1676
  outsideNamespaces: boolean
@@ -1753,7 +1723,7 @@ function FocusNotFound({ focus, hiddenByFilters, systemHidden, hideSystem, outsi
1753
1723
  >
1754
1724
  Leave focus
1755
1725
  </button>
1756
- {warningClusterScope && <ClusterScopeDocsLink />}
1726
+ {warningDocsUrl && <WarningDocsLink href={warningDocsUrl} />}
1757
1727
  </div>
1758
1728
  }
1759
1729
  className="max-w-md"
@@ -1,6 +1,6 @@
1
1
  import { describe, it, expect } from 'vitest'
2
2
  import type { AggregatedFlow, TrafficFlow } from '../../types'
3
- import { dataByProtocol, protocolsOf, totalDataByProtocol, rateWindowSeconds, throughputLabel, protocolName, matchesStatusRanges, bucketsFromCounts, bucketsFromStatus, isRateBasedSource, keepAvailable, effectiveThreshold, volumeUnit, isExternalKind, isPolicyDropReason, requestRateOf, errorRateOf, formatRate, displayVolume, groupAddonFlows, mergeFlowVolume, dedupeHTTPPairs, coverageLabel, latencyWeightOf, endpointPair, selectionRawPairs, mergeRawPairs, graphEndpoint, graphSize, parseFocus, focusParam, focusId, touchesFocus, focusNeighborhood, endpointSummaries, searchEndpoints, namespaceSummaries, namespaceOverBudget, hasStatusData, connectionRows, selectionMatch, edgeCarriesPort, edgesOnPort, mergedEdgePort, mergeEdgePortInto, portLabel, selectedEdgeMatcher, verdictChoices, warningRetries, warningBannerTitle, emptyWarningHeadline, protocolLabel, type GraphFlow } from './trafficFilters'
3
+ import { dataByProtocol, protocolsOf, totalDataByProtocol, rateWindowSeconds, throughputLabel, protocolName, matchesStatusRanges, bucketsFromCounts, bucketsFromStatus, isRateBasedSource, reportsVolumeCounts, keepAvailable, effectiveThreshold, volumeUnit, isExternalKind, isPolicyDropReason, requestRateOf, errorRateOf, formatRate, displayVolume, groupAddonFlows, collapseInternetFlows, mergeFlowVolume, dedupeHTTPPairs, coverageLabel, latencyWeightOf, endpointPair, selectionRawPairs, mergeRawPairs, graphEndpoint, graphSize, parseFocus, focusParam, focusId, touchesFocus, focusNeighborhood, endpointSummaries, searchEndpoints, namespaceSummaries, namespaceOverBudget, hasStatusData, connectionRows, selectionMatch, edgeCarriesPort, edgesOnPort, mergedEdgePort, mergeEdgePortInto, portLabel, selectedEdgeMatcher, verdictChoices, warningRetries, warningBannerTitle, emptyWarningHeadline, protocolLabel, type GraphFlow } from './trafficFilters'
4
4
 
5
5
  describe('matchesStatusRanges', () => {
6
6
  it('does not filter when nothing is selected', () => {
@@ -54,6 +54,15 @@ describe('isRateBasedSource', () => {
54
54
  })
55
55
  })
56
56
 
57
+ describe('reportsVolumeCounts', () => {
58
+ it('is false only for Caretta, which reports bytes alone', () => {
59
+ expect(reportsVolumeCounts('caretta')).toBe(false)
60
+ expect(reportsVolumeCounts('hubble')).toBe(true)
61
+ expect(reportsVolumeCounts('beyla')).toBe(true)
62
+ expect(reportsVolumeCounts(undefined)).toBe(true)
63
+ })
64
+ })
65
+
57
66
  describe('keepAvailable', () => {
58
67
  it('drops a choice whose control is no longer offered', () => {
59
68
  // The button is gone, so the selection must stop filtering — otherwise the map
@@ -707,6 +716,12 @@ describe('flows warning kinds', () => {
707
716
  expect(warningRetries('partial')).toBe(false)
708
717
  expect(warningRetries('incomplete')).toBe(false)
709
718
  expect(warningRetries('cluster')).toBe(false)
719
+ expect(warningRetries('setup')).toBe(false)
720
+ })
721
+
722
+ it('says a source that needs setup needs attention, not that traffic is missing', () => {
723
+ expect(emptyWarningHeadline('setup')).toBe('No traffic: the traffic source needs attention')
724
+ expect(warningBannerTitle('setup')).toBe('The traffic source needs attention')
710
725
  })
711
726
 
712
727
  it('does not call a cluster warning a fetch failure or missing traffic', () => {
@@ -730,6 +745,36 @@ describe('protocolLabel', () => {
730
745
  })
731
746
 
732
747
 
748
+ describe('collapseInternetFlows', () => {
749
+ const flow = (source: AggregatedFlow['source'], bytesSent: number): GraphFlow => {
750
+ const destination = { name: 'web', namespace: 'demo', kind: 'Workload' }
751
+ const f = { source, destination, bytesSent, bytesRecv: 0, bytesByProtocol: { tcp: { bytesSent, bytesRecv: 0 } }, connections: 1, flowCount: 1, port: 80, protocol: 'tcp', lastSeen: '' }
752
+ return { ...f, rawPairs: [endpointPair(f)] }
753
+ }
754
+ const sources = (flows: GraphFlow[]) => flows.map(f => f.source.name).sort()
755
+
756
+ it('keeps a private network and a NetworkSet apart from the internet', () => {
757
+ const collapsed = collapseInternetFlows([
758
+ flow({ name: 'Public network', namespace: '', kind: 'External', network: 'public' }, 100),
759
+ flow({ name: 'Private network', namespace: '', kind: 'External', network: 'private' }, 200),
760
+ flow({ name: 'office-vpn', namespace: '', kind: 'External', network: 'private' }, 300),
761
+ ])
762
+ expect(sources(collapsed)).toEqual(['Internet', 'Private network', 'office-vpn'])
763
+ expect(collapsed.find(f => f.source.name === 'Internet')).toMatchObject({ bytesSent: 100 })
764
+ })
765
+
766
+ it('merges sources the plugin did not classify, as before', () => {
767
+ const collapsed = collapseInternetFlows([
768
+ flow({ name: '203.0.113.7', namespace: '', kind: 'External' }, 100),
769
+ flow({ name: 'world', namespace: '', kind: 'External' }, 200),
770
+ flow({ name: 'Public network', namespace: '', kind: 'External', network: 'public' }, 300),
771
+ ])
772
+ expect(collapsed).toHaveLength(1)
773
+ expect(collapsed[0]).toMatchObject({ source: { name: 'Internet', kind: 'Internet' }, bytesSent: 600, flowCount: 3 })
774
+ expect(collapsed[0].rawPairs).toHaveLength(3)
775
+ })
776
+ })
777
+
733
778
  describe('groupAddonFlows', () => {
734
779
  const addon = (_name: string, namespace: string | undefined) => namespace === 'monitoring'
735
780
  const flow = (source: AggregatedFlow['source'], destination: AggregatedFlow['destination'], bytesSent: number): GraphFlow => {
@@ -935,3 +980,18 @@ describe('likely-overlay edges in a selection', () => {
935
980
  expect(on(record(overlay))).toBe(false)
936
981
  })
937
982
  })
983
+
984
+ describe('connectionRows', () => {
985
+ const row = (name: string, connections: number, bytesSent: number, bytesRecv: number): AggregatedFlow => ({
986
+ source: { namespace: 'shop', name: 'app', kind: 'Deployment' },
987
+ destination: { namespace: 'data', name, kind: 'Deployment' },
988
+ protocol: 'tcp', port: 5432, flowCount: 1, connections, bytesSent, bytesRecv, lastSeen: '',
989
+ })
990
+
991
+ it('orders zero-count bytes-only edges by total bytes descending', () => {
992
+ const small = row('small', 0, 100, 50)
993
+ const large = row('large', 0, 1000, 500)
994
+ const medium = row('medium', 0, 400, 200)
995
+ expect(connectionRows([small, medium, large]).map(f => f.destination.name)).toEqual(['large', 'medium', 'small'])
996
+ })
997
+ })
@@ -47,15 +47,24 @@ export function bucketsFromStatus(httpStatus: number | undefined): string[] {
47
47
  *
48
48
  * Beyla and Istio read counters out of Prometheus, so what they report per edge is
49
49
  * a per-second rate: "connections" is really requests per second, and the error
50
- * count is errors per second. Hubble and Caretta observe individual flows and
51
- * report genuine counts. The distinction changes units, labels and the sensible
52
- * scale of a volume filter, so it lives in one place rather than being re-derived
53
- * wherever it is needed.
50
+ * count is errors per second. Hubble observes individual flows and reports genuine
51
+ * counts; Caretta reports no count at all (see reportsVolumeCounts). The
52
+ * distinction changes units, labels and the sensible scale of a volume filter, so
53
+ * it lives in one place rather than being re-derived wherever it is needed.
54
54
  */
55
55
  export function isRateBasedSource(source: string | undefined): boolean {
56
56
  return source === 'istio' || source === 'beyla'
57
57
  }
58
58
 
59
+ /**
60
+ * Does this source report a per-edge count or rate at all? Caretta reports only the
61
+ * bytes moved in the window, so its edges carry a zero count that must be neither
62
+ * printed nor filtered on.
63
+ */
64
+ export function reportsVolumeCounts(source: string | undefined): boolean {
65
+ return source !== 'caretta'
66
+ }
67
+
59
68
  /**
60
69
  * The request and 5xx rates of an edge from a rate-based source, unrounded.
61
70
  *
@@ -492,6 +501,49 @@ export function mergeRawPairs(into: GraphFlow, from: GraphFlow): void {
492
501
  for (const pair of from.rawPairs ?? []) target.push(pair)
493
502
  }
494
503
 
504
+ /**
505
+ * Merges inbound traffic from the internet (an outside source to an inside
506
+ * destination) into one "Internet" source per destination and port. A source
507
+ * the plugin classified as a private network stays as it is: it is the
508
+ * cluster owner's own network (Calico's "Private network" and NetworkSets),
509
+ * not the internet. An unclassified source is merged, as every source's was
510
+ * before plugins classified any.
511
+ */
512
+ export function collapseInternetFlows(flows: GraphFlow[]): GraphFlow[] {
513
+ const internetFlowsMap = new Map<string, GraphFlow>() // destKey -> aggregated flow
514
+ const nonInternetFlows: GraphFlow[] = []
515
+
516
+ for (const flow of flows) {
517
+ const fromInternet = isExternalKind(flow.source.kind) && flow.source.network !== 'private'
518
+ if (!fromInternet || isExternalKind(flow.destination.kind)) {
519
+ nonInternetFlows.push(flow)
520
+ continue
521
+ }
522
+ // Key on destination + port, and on whether the direction is known: this
523
+ // collapse merges genuinely different external clients, so one of them
524
+ // arriving unoriented must not take the arrowhead off another's traffic.
525
+ const orientation = flow.directionUnknown ? '|u' : '|o'
526
+ const destKey = flow.destination.namespace
527
+ ? `${flow.destination.namespace}/${flow.destination.name}:${flow.port}${orientation}`
528
+ : `${flow.destination.name}:${flow.port}${orientation}`
529
+
530
+ const existing = internetFlowsMap.get(destKey)
531
+ if (existing) {
532
+ mergeFlowVolume(existing, flow)
533
+ mergeRawPairs(existing, flow)
534
+ mergeEdgePortInto(existing, flow)
535
+ } else {
536
+ internetFlowsMap.set(destKey, {
537
+ ...flow,
538
+ rawPairs: [...(flow.rawPairs ?? [])],
539
+ source: { name: 'Internet', namespace: '', kind: 'Internet' },
540
+ })
541
+ }
542
+ }
543
+
544
+ return [...nonInternetFlows, ...Array.from(internetFlowsMap.values())]
545
+ }
546
+
495
547
  export function groupAddonFlows(flows: GraphFlow[], isAddon: (name: string, namespace: string | undefined) => boolean): GraphFlow[] {
496
548
  let internet: GraphFlow | undefined
497
549
  let kubernetes: GraphFlow | undefined
@@ -856,10 +908,16 @@ export function namespaceSummaries(flows: AggregatedFlow[]): NamespaceSummary[]
856
908
  .sort((a, b) => byProblemsThenVolume(a, b) || a.name.localeCompare(b.name))
857
909
  }
858
910
 
859
- /** The edges as table rows, problems first, then volume. */
911
+ /** The edges as table rows, problems first, then volume, breaking zero-count ties by bytes. */
860
912
  export function connectionRows<T extends AggregatedFlow>(flows: T[]): T[] {
861
- const keyed = flows.map(flow => ({ flow, errors: flowErrors(flow), drops: flowDrops(flow), volume: flow.connections }))
862
- keyed.sort(byProblemsThenVolume)
913
+ const keyed = flows.map(flow => ({
914
+ flow,
915
+ errors: flowErrors(flow),
916
+ drops: flowDrops(flow),
917
+ volume: flow.connections,
918
+ bytes: flow.bytesSent + flow.bytesRecv,
919
+ }))
920
+ keyed.sort((a, b) => byProblemsThenVolume(a, b) || b.bytes - a.bytes)
863
921
  return keyed.map(k => k.flow)
864
922
  }
865
923
 
@@ -880,7 +938,7 @@ export function verdictChoices(seen: Iterable<string>): string[] {
880
938
  * a transient one (or one from a Radar that sends no kind) may clear on its own;
881
939
  * the rest are the answer, and polling them costs the source a burst of queries. */
882
940
  export function warningRetries(kind: TrafficWarningKind | undefined): boolean {
883
- return kind !== 'partial' && kind !== 'incomplete' && kind !== 'cluster'
941
+ return kind !== 'partial' && kind !== 'incomplete' && kind !== 'cluster' && kind !== 'setup'
884
942
  }
885
943
 
886
944
  /** Title of the banner shown beside flows that carry a warning. */
@@ -891,6 +949,7 @@ export function warningBannerTitle(kind: TrafficWarningKind | undefined): string
891
949
  // for missing workloads.
892
950
  case 'partial': return 'Some values on this map are unreliable'
893
951
  case 'cluster': return "This map may include other clusters' traffic"
952
+ case 'setup': return 'The traffic source needs attention'
894
953
  default: return 'Some traffic may be missing from this map'
895
954
  }
896
955
  }
@@ -901,6 +960,7 @@ export function emptyWarningHeadline(kind: TrafficWarningKind | undefined): stri
901
960
  case 'partial': return 'No traffic Radar can place on the map'
902
961
  case 'incomplete': return 'No traffic seen, but some may be missing'
903
962
  case 'cluster': return 'No traffic labeled as this cluster'
963
+ case 'setup': return 'No traffic: the traffic source needs attention'
904
964
  default: return 'Unable to fetch traffic data'
905
965
  }
906
966
  }
@@ -205,12 +205,12 @@ function AttentionGroup({ id, title, problems, visible, onNavigate }: { id: stri
205
205
  <h3 className="mb-1 text-xs font-semibold uppercase tracking-wide text-theme-text-tertiary">
206
206
  {title} <span className="font-normal">· {problems.length}</span>
207
207
  </h3>
208
- <ProblemList problems={shown} rootKind="" onNavigate={onNavigate} hideOrigin subjectFirst />
208
+ <ProblemList problems={shown} rootKind="" onNavigate={onNavigate} hideOrigin subjectFirst showNextStep />
209
209
  {folded.length > 0 && (
210
210
  <>
211
211
  <Collapse open={showAll} id={foldId}>
212
212
  <div className="pt-2">
213
- <ProblemList problems={folded} rootKind="" onNavigate={onNavigate} hideOrigin subjectFirst />
213
+ <ProblemList problems={folded} rootKind="" onNavigate={onNavigate} hideOrigin subjectFirst showNextStep />
214
214
  </div>
215
215
  </Collapse>
216
216
  <button
@@ -5,13 +5,12 @@ import { useAPIResources } from '../../api/apiResources'
5
5
  import { useVeleroWorkspace } from '../../api/velero'
6
6
  import { useNamespaces, useRadarFeature } from '../../api/client'
7
7
  import { useMediaQuery } from '../../hooks/useMediaQuery'
8
- import { useCNPGSidebarWorkspace } from '../cnpg/useCNPGSidebarWorkspace'
8
+ import { useIntegrationSidebars } from '../../integrations/sidebarWorkspaces'
9
9
  import { WorkspaceFrame } from '../workspace/WorkspaceFrame'
10
- import { useMergedSidebarWorkspaces } from '../workspace/sidebar'
11
10
  import { useWorkspaceDrawer } from '../workspace/useWorkspaceDrawer'
12
11
  import { VeleroScreenGate, useVeleroInstallation } from './shared'
13
12
  import { VeleroOverview } from './VeleroOverview'
14
- import { useVeleroSidebarWorkspace, veleroDiscovered } from './useVeleroSidebarWorkspace'
13
+ import { veleroDiscovered } from './useVeleroSidebarWorkspace'
15
14
  import { VELERO_DETAIL_KINDS, VELERO_GROUP, parseVeleroRoute } from './routes'
16
15
  import { VeleroDetailPage } from './VeleroDetailPage'
17
16
 
@@ -34,11 +33,9 @@ export function VeleroView({ namespaces, selectedResource, onOpenResource, onClo
34
33
  const discovered = veleroDiscovered(apiResources) || discoveryFailed
35
34
  const query = useVeleroWorkspace({ enabled: discovered })
36
35
  // An object's page highlights its kind's row; the Overview row only the Overview.
37
- const veleroSidebar = useVeleroSidebarWorkspace({ apiResources, active: !detail })
36
+ const sidebarWorkspace = useIntegrationSidebars({ apiResources, namespaces, velero: { active: !detail } })
38
37
  const plural = detail?.plural
39
38
  const selectedKind = useMemo(() => (plural ? { name: plural, kind: VELERO_DETAIL_KINDS[plural].kind, group: VELERO_GROUP } : null), [plural])
40
- const cnpgSidebar = useCNPGSidebarWorkspace({ apiResources, namespaces })
41
- const sidebarWorkspace = useMergedSidebarWorkspaces(cnpgSidebar, veleroSidebar)
42
39
  const { drawerTarget, inspect } = useWorkspaceDrawer({ selectedResource, onOpenResource, onCloseResource })
43
40
 
44
41
  const [installation, setInstallation] = useVeleroInstallation(query.data?.installations)