@skyhook-io/radar-app 1.22.1 → 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.
- package/package.json +8 -8
- package/src/App.tsx +131 -38
- package/src/RadarApp.basename.test.tsx +177 -0
- package/src/RadarApp.settings.test.tsx +33 -0
- package/src/RadarApp.tsx +5 -0
- package/src/api/agentSandbox.ts +259 -0
- package/src/api/client.autoPromConnect.test.tsx +43 -0
- package/src/api/client.metricsRelayCheck.test.tsx +134 -0
- package/src/api/client.ts +128 -25
- package/src/api/cloudInstallDiscover.test.tsx +76 -0
- package/src/api/diagnose.ts +4 -0
- package/src/api/kagent.test.ts +82 -0
- package/src/api/kagent.ts +230 -0
- package/src/api/prometheusCharts.ts +5 -0
- package/src/api/radarFeatures.test.ts +9 -0
- package/src/api/radarFeatures.ts +13 -0
- package/src/api/substrateWorkspace.test.ts +72 -0
- package/src/api/substrateWorkspace.ts +1394 -0
- package/src/api/vulnerabilities.ts +207 -9
- package/src/api/workloadSource.test.tsx +1172 -0
- package/src/api/workloadSource.ts +408 -0
- package/src/components/APIUnreachableBanner.test.tsx +19 -0
- package/src/components/APIUnreachableBanner.tsx +20 -0
- package/src/components/CloudConnectFlow.tsx +46 -7
- package/src/components/CloudFunnelButton.test.tsx +193 -7
- package/src/components/CloudFunnelButton.tsx +127 -32
- package/src/components/ConnectionErrorView.test.tsx +63 -2
- package/src/components/ConnectionErrorView.tsx +88 -68
- package/src/components/SelfManagedStart.tsx +12 -2
- package/src/components/agentsandbox/AgentSandboxKindLists.tsx +41 -0
- package/src/components/agentsandbox/AgentSandboxLists.test.tsx +410 -0
- package/src/components/agentsandbox/AgentSandboxOverview.test.tsx +333 -0
- package/src/components/agentsandbox/AgentSandboxOverview.tsx +555 -0
- package/src/components/agentsandbox/AgentSandboxSidebar.test.tsx +97 -0
- package/src/components/agentsandbox/AgentSandboxSummary.test.tsx +439 -0
- package/src/components/agentsandbox/AgentSandboxSummary.tsx +956 -0
- package/src/components/agentsandbox/AgentSandboxTables.tsx +966 -0
- package/src/components/agentsandbox/AgentSandboxView.tsx +34 -0
- package/src/components/agentsandbox/agentsandbox.fixtures.ts +135 -0
- package/src/components/agentsandbox/data.ts +135 -0
- package/src/components/agentsandbox/host.test.ts +27 -0
- package/src/components/agentsandbox/host.tsx +85 -0
- package/src/components/agentsandbox/labels.test.ts +42 -0
- package/src/components/agentsandbox/labels.ts +146 -0
- package/src/components/agentsandbox/listFilters.ts +85 -0
- package/src/components/agentsandbox/lists.ts +52 -0
- package/src/components/agentsandbox/routes.ts +23 -0
- package/src/components/agentsandbox/shared.tsx +321 -0
- package/src/components/agentsandbox/useAgentSandboxSidebarWorkspace.ts +69 -0
- package/src/components/agentsandbox/workspace.fixtures.ts +125 -0
- package/src/components/agentsandbox/workspace.tsx +258 -0
- package/src/components/agentsandbox/workspaceRoute.ts +18 -0
- package/src/components/applications/ApplicationsView.openResource.test.tsx +248 -3
- package/src/components/applications/ApplicationsView.tsx +156 -3
- package/src/components/audit/VulnerabilitiesColumns.test.tsx +487 -0
- package/src/components/audit/VulnerabilitiesRisk.test.tsx +318 -0
- package/src/components/audit/VulnerabilitiesView.test.tsx +458 -13
- package/src/components/audit/VulnerabilitiesView.tsx +639 -199
- package/src/components/cloudHints/AgentSetupCloudRow.tsx +28 -0
- package/src/components/cloudHints/CloudHintLink.tsx +29 -0
- package/src/components/cloudHints/SharedInstallAiLine.tsx +36 -0
- package/src/components/cloudHints/cloudHints.test.ts +126 -0
- package/src/components/cloudHints/cloudHints.ts +131 -0
- package/src/components/cloudHints/cloudHintsGate.test.tsx +70 -0
- package/src/components/cloudHints/cloudLinks.test.ts +52 -0
- package/src/components/cloudHints/cloudLinks.ts +31 -0
- package/src/components/cloudHints/hintStorage.ts +28 -0
- package/src/components/cnpg/CNPGView.tsx +4 -7
- package/src/components/diagnose/ActivityTurn.tsx +6 -4
- package/src/components/diagnose/AgentSetupNotice.tsx +5 -0
- package/src/components/diagnose/AssessmentCard.tsx +1 -2
- package/src/components/diagnose/ContinueInAgentButton.test.tsx +7 -0
- package/src/components/diagnose/DiagnoseContext.tsx +7 -0
- package/src/components/diagnose/DiagnoseSurface.escape.test.tsx +215 -0
- package/src/components/diagnose/DiagnoseSurface.tsx +57 -1
- package/src/components/diagnose/Home.test.tsx +6 -0
- package/src/components/diagnose/Home.tsx +10 -3
- package/src/components/diagnose/InvestigationEvidencePane.story.test.tsx +1 -1
- package/src/components/diagnose/InvestigationEvidencePane.tsx +19 -2
- package/src/components/diagnose/InvestigationFindingsFooter.test.tsx +413 -0
- package/src/components/diagnose/InvestigationView.tsx +120 -23
- package/src/components/diagnose/investigationEvidence/identity.test.ts +1 -1
- package/src/components/diagnose/investigationEvidence/projection.test.ts +1 -1
- package/src/components/diagnose/investigationState.ts +9 -0
- package/src/components/diagnose/parts.test.tsx +11 -3
- package/src/components/diagnose/toolCallLabel.ts +3 -0
- package/src/components/gitops/RemoteDestinationCloudHint.tsx +6 -14
- package/src/components/home/ActivitySummary.tsx +3 -8
- package/src/components/home/ClusterHealthCard.tsx +91 -17
- package/src/components/home/ClusterHealthCard.utilization.test.tsx +187 -0
- package/src/components/home/HomeAgentBlock.tsx +2 -0
- package/src/components/home/HomeView.tsx +9 -29
- package/src/components/home/MCPSetupDialog.test.tsx +9 -0
- package/src/components/home/MCPSetupDialog.tsx +6 -2
- package/src/components/home/McpCloudLine.test.tsx +162 -0
- package/src/components/home/McpCloudLine.tsx +95 -0
- package/src/components/home/ProblemsPanel.investigate.test.tsx +2 -2
- package/src/components/home/TopologyPreview.test.tsx +31 -30
- package/src/components/home/TopologyPreview.tsx +19 -28
- package/src/components/home/mcpToolCatalog.test.ts +10 -0
- package/src/components/home/mcpToolCatalog.ts +7 -7
- package/src/components/issues/ClusterSchedulingBlockerRow.tsx +35 -0
- package/src/components/issues/IssuesPane.render.test.tsx +36 -1
- package/src/components/issues/IssuesPane.tsx +181 -23
- package/src/components/issues/SinceLastVisitRow.render.test.tsx +302 -0
- package/src/components/issues/SinceLastVisitRow.tsx +71 -0
- package/src/components/issues/sinceLastVisit.test.ts +266 -0
- package/src/components/issues/sinceLastVisit.ts +439 -0
- package/src/components/kagent/KagentAgentRenderer.test.ts +32 -0
- package/src/components/kagent/KagentAgentRenderer.tsx +87 -0
- package/src/components/kagent/KagentAgentSessions.test.tsx +166 -0
- package/src/components/kagent/KagentAgentSessions.tsx +124 -0
- package/src/components/kagent/KagentDetailPage.tsx +106 -0
- package/src/components/kagent/KagentLists.tsx +412 -0
- package/src/components/kagent/KagentOverview.tsx +234 -0
- package/src/components/kagent/KagentPages.tsx +690 -0
- package/src/components/kagent/KagentRuntimeTabs.test.tsx +219 -0
- package/src/components/kagent/KagentRuntimeTabs.tsx +283 -0
- package/src/components/kagent/KagentSidebar.test.tsx +112 -0
- package/src/components/kagent/KagentView.tsx +109 -0
- package/src/components/kagent/KagentWorkspace.test.tsx +876 -0
- package/src/components/kagent/host.tsx +144 -0
- package/src/components/kagent/routes.ts +31 -0
- package/src/components/kagent/shared.tsx +336 -0
- package/src/components/kagent/useKagentRuntime.test.tsx +77 -0
- package/src/components/kagent/useKagentSidebarWorkspace.ts +67 -0
- package/src/components/kagent/workspace.fixtures.ts +108 -0
- package/src/components/kagent/workspaceRoute.ts +18 -0
- package/src/components/resource/MetricsNotConnected.test.tsx +28 -0
- package/src/components/resource/MetricsNotConnected.tsx +10 -7
- package/src/components/resource/PrometheusCharts.tsx +10 -1
- package/src/components/resource/PrometheusChartsGrid.render.test.tsx +9 -0
- package/src/components/resource/PrometheusChartsGrid.tsx +3 -3
- package/src/components/resource/SubstrateHealthCharts.test.tsx +13 -1
- package/src/components/resource/SubstrateHealthCharts.tsx +9 -15
- package/src/components/resources/ResourceDetailDrawer.tsx +1 -0
- package/src/components/resources/ResourcesView.tsx +2 -6
- package/src/components/resources/renderers/JobAdmissionRenderers.tsx +5 -4
- package/src/components/resources/renderers/PodRenderer.tsx +8 -2
- package/src/components/resources/renderers/RolloutRenderer.tsx +4 -1
- package/src/components/resources/renderers/WorkloadRenderer.tsx +4 -1
- package/src/components/settings/LocalIntegrationStatus.test.tsx +1 -0
- package/src/components/settings/LocalIntegrationStatus.tsx +3 -2
- package/src/components/settings/SettingsDialog.tsx +84 -16
- package/src/components/settings/SubstrateSettings.lifecycle.test.tsx +210 -0
- package/src/components/settings/SubstrateSettings.test.tsx +131 -0
- package/src/components/settings/SubstrateSettings.tsx +544 -0
- package/src/components/settings/settings-state.test.ts +21 -3
- package/src/components/settings/settings-state.ts +13 -3
- package/src/components/share/ShareLinkButton.test.tsx +360 -0
- package/src/components/share/ShareLinkButton.tsx +391 -0
- package/src/components/share/openShareInCloud.test.ts +29 -0
- package/src/components/share/openShareInCloud.ts +10 -0
- package/src/components/share/shareLink.test.ts +129 -0
- package/src/components/share/shareLink.ts +175 -0
- package/src/components/substrate/SubstrateActorDrawer.tsx +87 -0
- package/src/components/substrate/SubstrateActorOverview.tsx +489 -0
- package/src/components/substrate/SubstrateActorPage.tsx +384 -0
- package/src/components/substrate/SubstrateActors.test.tsx +1094 -0
- package/src/components/substrate/SubstrateActors.tsx +612 -0
- package/src/components/substrate/SubstrateAttentionList.tsx +441 -0
- package/src/components/substrate/SubstrateConnect.tsx +88 -0
- package/src/components/substrate/SubstrateOverview.test.tsx +396 -0
- package/src/components/substrate/SubstrateOverview.tsx +575 -0
- package/src/components/substrate/SubstratePages.test.tsx +478 -0
- package/src/components/substrate/SubstratePool.test.tsx +462 -0
- package/src/components/substrate/SubstratePoolPage.tsx +95 -0
- package/src/components/substrate/SubstratePoolSummary.tsx +485 -0
- package/src/components/substrate/SubstrateSidebar.test.tsx +101 -0
- package/src/components/substrate/SubstrateStateBar.tsx +63 -0
- package/src/components/substrate/SubstrateTemplates.tsx +376 -0
- package/src/components/substrate/SubstrateView.tsx +173 -0
- package/src/components/substrate/SubstrateWorkerPodContext.tsx +73 -0
- package/src/components/substrate/SubstrateWorkers.tsx +389 -0
- package/src/components/substrate/attention.ts +81 -0
- package/src/components/substrate/contextPin.tsx +69 -0
- package/src/components/substrate/host.tsx +83 -0
- package/src/components/substrate/kubectlTarget.test.tsx +77 -0
- package/src/components/substrate/readings.test.ts +484 -0
- package/src/components/substrate/readings.ts +997 -0
- package/src/components/substrate/routes.ts +103 -0
- package/src/components/substrate/shared.tsx +426 -0
- package/src/components/substrate/substrate.fixtures.ts +325 -0
- package/src/components/substrate/useSubstrateSidebarWorkspace.ts +87 -0
- package/src/components/substrate/workspaceRoute.ts +23 -0
- package/src/components/traffic/TrafficConnectionsTable.test.tsx +9 -0
- package/src/components/traffic/TrafficConnectionsTable.tsx +4 -2
- package/src/components/traffic/TrafficFilterSidebar.tsx +19 -14
- package/src/components/traffic/TrafficFlowList.test.tsx +63 -0
- package/src/components/traffic/TrafficFlowList.tsx +9 -5
- package/src/components/traffic/TrafficGraph.test.tsx +26 -0
- package/src/components/traffic/TrafficGraph.tsx +17 -14
- package/src/components/traffic/TrafficGraphTooLarge.tsx +2 -0
- package/src/components/traffic/TrafficGraphUnavailable.tsx +3 -1
- package/src/components/traffic/TrafficView.tsx +26 -56
- package/src/components/traffic/trafficFilters.test.ts +61 -1
- package/src/components/traffic/trafficFilters.ts +68 -8
- package/src/components/velero/VeleroOverview.tsx +2 -2
- package/src/components/velero/VeleroView.tsx +3 -6
- package/src/components/vulnerabilities/columns.tsx +132 -0
- package/src/components/vulnerabilities/filters.tsx +317 -0
- package/src/components/vulnerabilities/owner.test.ts +54 -0
- package/src/components/vulnerabilities/owner.tsx +163 -0
- package/src/components/vulnerabilities/parts.test.ts +126 -12
- package/src/components/vulnerabilities/parts.tsx +612 -52
- package/src/components/vulnerabilities/traffic.test.tsx +65 -0
- package/src/components/vulnerabilities/traffic.tsx +40 -0
- package/src/components/workload/WorkloadView.substrateVersion.test.tsx +88 -0
- package/src/components/workload/WorkloadView.tsx +119 -14
- package/src/components/workload/WorkloadView.workloadSource.test.tsx +121 -0
- package/src/components/workspace/layout.tsx +13 -7
- package/src/components/workspace/sidebar.test.ts +48 -0
- package/src/components/workspace/sidebar.ts +73 -3
- package/src/components/workspace/table.ts +2 -1
- package/src/context/ConnectionContext.tsx +24 -5
- package/src/context/ConnectionProvider.connectionId.test.tsx +14 -0
- package/src/context/ConnectionProvider.handover.test.tsx +94 -0
- package/src/context/DiagnoseCustomization.tsx +20 -2
- package/src/contexts/RegistryAccessMode.test.tsx +51 -0
- package/src/contexts/RegistryAccessMode.tsx +25 -0
- package/src/hooks/useEventSource.test.tsx +275 -4
- package/src/hooks/useEventSource.ts +278 -51
- package/src/index.ts +1 -0
- package/src/integrations/resourceHost.ts +12 -6
- package/src/integrations/resourceHosts.test.tsx +27 -1
- package/src/integrations/resourceHosts.tsx +15 -7
- package/src/integrations/sidebarWorkspaces.test.tsx +63 -0
- package/src/integrations/sidebarWorkspaces.ts +41 -0
- package/src/integrations/workspaceRoute.ts +1 -1
- package/src/integrations/workspaceRoutes.ts +7 -1
- package/src/integrations/workspaceScreens.tsx +6 -0
- package/src/utils/navigation.test.ts +1 -6
- package/src/utils/navigation.ts +9 -44
- package/src/utils/network-policy-navigation.test.ts +21 -36
|
@@ -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)
|
|
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.
|
|
879
|
-
//
|
|
880
|
-
//
|
|
881
|
-
// traffic
|
|
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
|
-
//
|
|
1409
|
-
//
|
|
1410
|
-
|
|
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
|
-
|
|
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={
|
|
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={
|
|
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
|
-
|
|
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
|
-
|
|
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={
|
|
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,
|
|
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
|
-
/**
|
|
1703
|
-
|
|
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
|
-
{
|
|
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
|
|
51
|
-
*
|
|
52
|
-
*
|
|
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 => ({
|
|
862
|
-
|
|
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 {
|
|
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 {
|
|
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
|
|
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)
|