@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.
- package/package.json +8 -8
- package/src/App.tsx +35 -10
- package/src/RadarApp.basename.test.tsx +177 -0
- package/src/RadarApp.settings.test.tsx +33 -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 +122 -24
- 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 +315 -0
- package/src/api/workloadSource.ts +128 -12
- 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/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/AgentSetupNotice.tsx +5 -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/gitops/RemoteDestinationCloudHint.tsx +6 -14
- package/src/components/home/HomeAgentBlock.tsx +2 -0
- package/src/components/home/HomeView.tsx +3 -3
- 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/mcpToolCatalog.test.ts +10 -0
- package/src/components/home/mcpToolCatalog.ts +4 -4
- 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/PodRenderer.tsx +8 -2
- 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 +52 -13
- 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/contexts/RegistryAccessMode.test.tsx +51 -0
- package/src/contexts/RegistryAccessMode.tsx +25 -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
|
@@ -0,0 +1,575 @@
|
|
|
1
|
+
import { Fragment, useState, type ReactNode } from 'react'
|
|
2
|
+
import { toneTextClass, Badge, CertaintyGlyph, DimensionValue, FactGrid, FactRow, FoldSection, Input, Tooltip, WorkspaceCard, worseTone, type StatusTone } from '@skyhook-io/k8s-ui'
|
|
3
|
+
import type { SubstrateAtespaceRead, SubstrateAttention, SubstratePoolRow, SubstrateStatus, SubstrateWorkspace } from '../../api/substrateWorkspace'
|
|
4
|
+
import type { SelectedResource } from '../../types'
|
|
5
|
+
import { refToSelectedResource } from '../../utils/navigation'
|
|
6
|
+
import { ScreenBody, SectionTable, Segments, Sub, type TableColumn } from '../workspace/layout'
|
|
7
|
+
import { INCOMPLETE_COVERAGE_STATES, coverageEmpty, coverageLabel } from '../workspace/coverage'
|
|
8
|
+
import { useWorkspaceNavigate } from '../workspace/useWorkspaceNavigate'
|
|
9
|
+
import { attentionArea, coverageInPart, countText, lackingText, poolReading, poolReadyPods, worstAttentionTone, type AttentionArea } from './readings'
|
|
10
|
+
import { SUBSTRATE_GROUP, SUBSTRATE_POOLS_PATH, SUBSTRATE_SCREENS, substrateActorsPath } from './routes'
|
|
11
|
+
import { SubstrateAttentionList, type OpenSubject } from './SubstrateAttentionList'
|
|
12
|
+
import { SubstrateConnectNotice, SubstrateConnectionLink, SubstrateTierBanner, showsConnectNotice } from './SubstrateConnect'
|
|
13
|
+
import { SubstrateStateBar } from './SubstrateStateBar'
|
|
14
|
+
import { NOT_CONNECTED_TITLE, Name, SubstrateCoverageNotice, SubstrateHeader, SubstrateRefreshFailure, SubstrateSourceLine, Term, Unread } from './shared'
|
|
15
|
+
|
|
16
|
+
export const SUBSTRATE_NO_PROBLEMS = 'No problems found by the checks that ran.'
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* What the checks covered. An empty list says only that these checks found
|
|
20
|
+
* nothing: it names them, the ones that could not run and why, and what no
|
|
21
|
+
* check reads, so it never reads as "healthy". With problems listed, the same
|
|
22
|
+
* list folds under them.
|
|
23
|
+
*/
|
|
24
|
+
function ChecksSummary({ data, empty }: { data: SubstrateWorkspace; empty?: boolean }) {
|
|
25
|
+
const ran = data.checks.filter((c) => c.ran)
|
|
26
|
+
// A check waiting on Radar's first collection from Prometheus runs on a later read: it is still running, not one that could not.
|
|
27
|
+
const running = data.checks.filter((c) => !c.ran && c.collecting)
|
|
28
|
+
const skipped = data.checks.filter((c) => !c.ran && !c.collecting)
|
|
29
|
+
const counts = [running.length > 0 && `${running.length} still running`, skipped.length > 0 && `${skipped.length} could not`].filter(Boolean)
|
|
30
|
+
const body = (
|
|
31
|
+
<div className="space-y-2 text-xs text-theme-text-secondary">
|
|
32
|
+
{ran.length > 0 && <CheckList title="Checks that ran" items={ran.map((c) => c.label)} />}
|
|
33
|
+
{running.length > 0 && <CheckList title={`Still running: ${running[0].why ?? 'their inputs are still being collected'}`} items={running.map((c) => c.label)} />}
|
|
34
|
+
{skipped.length > 0 && <CheckList title="Not checked on this read" items={skipped.map((c) => `${c.label}: ${c.why ?? 'its inputs were not read'}`)} />}
|
|
35
|
+
{data.notAssessed.length > 0 && <CheckList title="Not assessed by any check" items={data.notAssessed} />}
|
|
36
|
+
</div>
|
|
37
|
+
)
|
|
38
|
+
return (
|
|
39
|
+
<>
|
|
40
|
+
{empty && <p className="text-sm text-theme-text-primary">{ran.length > 0 ? SUBSTRATE_NO_PROBLEMS : 'No check could run on this read.'}</p>}
|
|
41
|
+
<div className="mt-2 border-t-subtle pt-2">
|
|
42
|
+
<FoldSection title="What was checked" summary={`${ran.length} of ${data.checks.length} checks ran${counts.length ? ` · ${counts.join(', ')}` : ''}`} attention={false}>
|
|
43
|
+
{body}
|
|
44
|
+
</FoldSection>
|
|
45
|
+
</div>
|
|
46
|
+
</>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function CheckList({ title, items }: { title?: string; items: string[] }) {
|
|
51
|
+
return (
|
|
52
|
+
<div>
|
|
53
|
+
{title && <div className="text-theme-text-tertiary">{title}</div>}
|
|
54
|
+
<ul className="mt-0.5 list-disc space-y-0.5 pl-4">
|
|
55
|
+
{items.map((i) => <li key={i}>{i}</li>)}
|
|
56
|
+
</ul>
|
|
57
|
+
</div>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface SubstrateOverviewProps {
|
|
62
|
+
data: SubstrateWorkspace
|
|
63
|
+
status?: SubstrateStatus
|
|
64
|
+
onOpenSubject: OpenSubject
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
interface Fact {
|
|
68
|
+
label: ReactNode
|
|
69
|
+
value: ReactNode
|
|
70
|
+
tone: StatusTone
|
|
71
|
+
/** The count covers only part of what exists. */
|
|
72
|
+
lowerBound?: boolean
|
|
73
|
+
title?: string
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function FleetValue({ fact }: { fact: Fact }) {
|
|
77
|
+
return (
|
|
78
|
+
<>
|
|
79
|
+
{fact.lowerBound && <CertaintyGlyph certainty="lower_bound" title="At least: some of it could not be read" />}
|
|
80
|
+
{fact.title ? <Tooltip content={fact.title}><span>{fact.value}</span></Tooltip> : fact.value}
|
|
81
|
+
</>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* A fact's tone where Needs attention has rows about its kind: the worst of
|
|
87
|
+
* theirs, so a condition reads one tone in its row and in the fact. Info rows
|
|
88
|
+
* are expected and do not colour it.
|
|
89
|
+
*/
|
|
90
|
+
function areaTone(data: SubstrateWorkspace, area: AttentionArea, base: StatusTone): StatusTone {
|
|
91
|
+
const rows = data.needsAttention.filter((a) => a.severity !== 'info' && attentionArea(a) === area)
|
|
92
|
+
const worst = worstAttentionTone(rows)
|
|
93
|
+
return worst ? worseTone(base, worst) : base
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The actor-slot fact. Free slots are not counted out as room: Substrate's
|
|
98
|
+
* per-worker actor cap (1,000 by default) usually far exceeds what the
|
|
99
|
+
* workers' CPU and memory hold, so a free count would overstate capacity.
|
|
100
|
+
* Pools whose workers lack the CPU or memory for another actor are named.
|
|
101
|
+
*/
|
|
102
|
+
function slotsFact(slots: NonNullable<SubstrateWorkspace['summary']['slots']>, freeSlots: SubstrateWorkspace['summary']['freeSlots'], partial: boolean): Omit<Fact, 'label'> {
|
|
103
|
+
if (partial) return {
|
|
104
|
+
value: slots.total > 0
|
|
105
|
+
? `${slots.used > 0 ? `≥${countText(slots.used)} actor slots used` : 'Slot usage unknown'} · ≥${countText(slots.total)} actor slots`
|
|
106
|
+
: 'Actor slot capacity unknown',
|
|
107
|
+
tone: 'unknown',
|
|
108
|
+
}
|
|
109
|
+
const used = `${countText(slots.used)} of ${countText(slots.total)} actor slots used`
|
|
110
|
+
const title = 'Over active workers, the only ones Substrate places actors on.'
|
|
111
|
+
const free = slots.total - slots.used
|
|
112
|
+
if (free <= 0) return { value: used, tone: 'degraded', title }
|
|
113
|
+
const blocked = (freeSlots ?? []).filter((f) => f.lacking)
|
|
114
|
+
const blockedFree = blocked.reduce((n, f) => n + f.free, 0)
|
|
115
|
+
const lacking = new Set(blocked.map((f) => f.lacking))
|
|
116
|
+
const what = lacking.size === 1 ? lackingText([...lacking][0]) : 'CPU or memory'
|
|
117
|
+
const unfit = `${blocked.length === 1 ? `${blocked[0].pool.name}’s workers have` : `${blocked.length} pools’ workers have`} no ${what} left for an actor`
|
|
118
|
+
const fitTitle = `${title} Slots count actors only: placement also books each actor’s CPU and memory.`
|
|
119
|
+
if (blockedFree > 0 && blockedFree >= free) {
|
|
120
|
+
return { value: `${used} · ${unfit}`, tone: 'degraded', title: fitTitle }
|
|
121
|
+
}
|
|
122
|
+
if (blockedFree > 0) return { value: `${used} · ${unfit}`, tone: 'healthy', title: fitTitle }
|
|
123
|
+
return { value: used, tone: 'healthy', title: fitTitle }
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** The status line: pools, workers, slots, actors, templates. A value Radar did not read says so, never 0. */
|
|
127
|
+
export function overviewFacts(data: SubstrateWorkspace): Fact[] {
|
|
128
|
+
const { summary } = data
|
|
129
|
+
const connected = data.apiTier.state === 'connected'
|
|
130
|
+
const cov = data.coverage
|
|
131
|
+
const poolsPartial = INCOMPLETE_COVERAGE_STATES.has(data.coverage.pools.state)
|
|
132
|
+
const facts: Fact[] = []
|
|
133
|
+
|
|
134
|
+
const pools = summary.pools
|
|
135
|
+
if (pools) {
|
|
136
|
+
const noRoom = pools.noRoom
|
|
137
|
+
const poolNotes = [pools.short > 0 && `${pools.short} short of workers`, pools.full > 0 && `${pools.full} full`, noRoom > 0 && `${noRoom} with no room for an actor`].filter(Boolean)
|
|
138
|
+
facts.push({
|
|
139
|
+
label: 'Worker pools',
|
|
140
|
+
value: poolsPartial && pools.total === 0 ? 'Pool count unknown' : [`${countText(pools.total)} ${pools.total === 1 ? 'pool' : 'pools'}`, ...poolNotes].join(' · '),
|
|
141
|
+
tone: areaTone(data, 'pools', poolNotes.length > 0 ? 'degraded' : pools.total > 0 ? 'healthy' : poolsPartial ? 'unknown' : 'neutral'),
|
|
142
|
+
lowerBound: poolsPartial && pools.total > 0,
|
|
143
|
+
title: poolsPartial ? `WorkerPools: ${coverageLabel(data.coverage.pools)}` : undefined,
|
|
144
|
+
})
|
|
145
|
+
} else {
|
|
146
|
+
facts.push({ label: 'Worker pools', value: <Unread title={`WorkerPools: ${coverageLabel(data.coverage.pools)}`}>unknown</Unread>, tone: 'unknown' })
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (summary.workers) {
|
|
150
|
+
const w = summary.workers
|
|
151
|
+
const partial = coverageInPart(cov.workers)
|
|
152
|
+
const notes = [w.draining > 0 && `${w.draining} draining`, w.unavailable > 0 && `${w.unavailable} unavailable`].filter(Boolean)
|
|
153
|
+
facts.push({
|
|
154
|
+
label: 'Workers',
|
|
155
|
+
value: [partial && w.active === 0 ? 'Active worker count unknown' : `${partial ? '≥' : ''}${countText(w.active)} active`, ...notes.map((note) => partial ? `≥${note}` : note)].join(' · '),
|
|
156
|
+
// An unavailable worker is at risk (alert), the tone of its chip and its row.
|
|
157
|
+
tone: areaTone(data, 'workers', w.unavailable > 0 ? 'alert' : partial ? 'unknown' : w.total > 0 ? 'healthy' : 'neutral'),
|
|
158
|
+
})
|
|
159
|
+
} else {
|
|
160
|
+
// Without the API, the worker Pods Kubernetes calls ready stand in, said as Pods.
|
|
161
|
+
const k8s = data.pools.map((p) => p.kubernetes).filter((p): p is NonNullable<SubstratePoolRow['kubernetes']> => !!p)
|
|
162
|
+
const readable = k8s.map(poolReadyPods).filter((ready) => ready !== undefined)
|
|
163
|
+
const ready = readable.reduce((n, count) => n + count, 0)
|
|
164
|
+
const podsPartial = poolsPartial || readable.length < k8s.length
|
|
165
|
+
const desired = k8s.every((p) => p.desired !== undefined) ? k8s.reduce((n, p) => n + (p.desired ?? 0), 0) : undefined
|
|
166
|
+
facts.push({
|
|
167
|
+
label: 'Worker Pods',
|
|
168
|
+
value: (readable.length === 0 || (podsPartial && ready === 0)) ? 'Worker Pod readiness unknown' : `${countText(ready)} Pods ready${desired !== undefined ? ` of ${countText(desired)} desired` : ''}`,
|
|
169
|
+
tone: readable.length === 0 || podsPartial ? 'unknown' : desired !== undefined && ready < desired ? 'degraded' : 'neutral',
|
|
170
|
+
title: 'Ready worker Pods, from Kubernetes. Whether Substrate places actors on them needs its API.',
|
|
171
|
+
lowerBound: podsPartial && ready > 0,
|
|
172
|
+
})
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (summary.slots) {
|
|
176
|
+
facts.push({ ...slotsFact(summary.slots, summary.freeSlots, coverageInPart(cov.workers)), label: <Term term="slot">Actor slots</Term> })
|
|
177
|
+
} else {
|
|
178
|
+
facts.push({ label: <Term term="slot">Actor slots</Term>, value: <Unread title={NOT_CONNECTED_TITLE}>{connected ? 'unknown' : 'Not connected'}</Unread>, tone: 'unknown' })
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (summary.actors) {
|
|
182
|
+
const partial = coverageInPart(cov.actors)
|
|
183
|
+
const countUnknown = partial && summary.actors.total === 0
|
|
184
|
+
facts.push({
|
|
185
|
+
label: 'Actors',
|
|
186
|
+
value: countUnknown ? 'Actor count unknown' : `${countText(summary.actors.total)} total${summary.actors.crashed > 0 ? `, ${countText(summary.actors.crashed)} crashed` : ''}`,
|
|
187
|
+
tone: countUnknown ? 'unknown' : summary.actors.crashed > 0 ? 'unhealthy' : summary.actors.total > 0 ? 'healthy' : 'neutral',
|
|
188
|
+
lowerBound: partial && summary.actors.total > 0,
|
|
189
|
+
})
|
|
190
|
+
} else {
|
|
191
|
+
facts.push({ label: 'Actors', value: <Unread title={NOT_CONNECTED_TITLE}>{connected ? 'unknown' : 'Not connected'}</Unread>, tone: 'unknown' })
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (summary.templates) {
|
|
195
|
+
const t = summary.templates
|
|
196
|
+
const partial = coverageInPart(cov.templates)
|
|
197
|
+
const countUnknown = partial && t.total === 0
|
|
198
|
+
const noPool = t.noMatchingPool ?? 0
|
|
199
|
+
const notes: ReactNode[] = [
|
|
200
|
+
t.goldenFailed > 0 && <>{t.goldenFailed} <Term term="golden">golden snapshot</Term> failed</>,
|
|
201
|
+
noPool > 0 && `${noPool} with no pool`,
|
|
202
|
+
].filter(Boolean)
|
|
203
|
+
facts.push({
|
|
204
|
+
label: 'Templates',
|
|
205
|
+
// Fragments, not spans: the value sits in a flex row whose gap would push each comma away from its word.
|
|
206
|
+
value: countUnknown ? 'Template count unknown' : <span>{[`${countText(t.total)} ${t.total === 1 ? 'template' : 'templates'}`, ...notes].map((n, i) => <Fragment key={i}>{i > 0 && ' · '}{n}</Fragment>)}</span>,
|
|
207
|
+
// A template no pool matches is at risk (alert), as its badge and row say; a failed golden snapshot is a warning.
|
|
208
|
+
tone: countUnknown ? 'unknown' : areaTone(data, 'templates', noPool > 0 ? 'alert' : t.goldenFailed > 0 ? 'degraded' : t.total > 0 ? 'healthy' : 'neutral'),
|
|
209
|
+
lowerBound: partial && t.total > 0,
|
|
210
|
+
})
|
|
211
|
+
} else {
|
|
212
|
+
facts.push({ label: 'Templates', value: <Unread title={NOT_CONNECTED_TITLE}>{connected ? 'unknown' : 'Not connected'}</Unread>, tone: 'unknown' })
|
|
213
|
+
}
|
|
214
|
+
facts.push(...serviceFacts(data))
|
|
215
|
+
return facts
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const pct = (v: number) => `${v < 10 ? v.toFixed(1).replace(/\.0$/, '') : Math.round(v)}%`
|
|
219
|
+
const secs = (v: number) => `${v < 10 ? v.toFixed(1).replace(/\.0$/, '') : Math.round(v)}s`
|
|
220
|
+
|
|
221
|
+
/** Whether Prometheus gave any Substrate reading at all on this read. */
|
|
222
|
+
export function serviceMeasured(svc: SubstrateWorkspace['service']): boolean {
|
|
223
|
+
return svc.read && (svc.slowestResume !== undefined || svc.crashes !== undefined || svc.nodesOverdue > 0 || svc.mostFailedResumes !== undefined)
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* What Prometheus says about delivery: resume latency and failures, crashes
|
|
228
|
+
* and overdue uploads. Two rules keep it honest beside the inventory: a value
|
|
229
|
+
* Prometheus didn't give is unknown, never a calm "none"; and where Substrate's
|
|
230
|
+
* API holds a definite problem (crashed actors, unstored snapshots), that sets
|
|
231
|
+
* the colour, whatever Prometheus counted.
|
|
232
|
+
*/
|
|
233
|
+
export function serviceFacts(data: Pick<SubstrateWorkspace, 'service' | 'summary' | 'needsAttention'>): Fact[] {
|
|
234
|
+
const svc = data.service
|
|
235
|
+
const window = svc.window ?? '1h'
|
|
236
|
+
const crashedNow = data.summary.actors?.crashed ?? 0
|
|
237
|
+
const uploadRows = data.needsAttention.filter((a) => a.rule === 'uploadOverdue' || a.rule === 'nodeUploadsOverdue')
|
|
238
|
+
const unstored = data.needsAttention.filter((a) => a.rule === 'uploadOverdue').reduce((n, a) => n + a.count, 0)
|
|
239
|
+
const facts: Fact[] = []
|
|
240
|
+
if (!serviceMeasured(svc)) {
|
|
241
|
+
facts.push({
|
|
242
|
+
label: `Delivery (${window})`,
|
|
243
|
+
// While the first collection runs, "no Substrate metrics" would claim an absence Radar hasn't read yet.
|
|
244
|
+
value: svc.collecting
|
|
245
|
+
? <Unread title={svc.why}>being collected from Prometheus</Unread>
|
|
246
|
+
: <Unread title={svc.why ?? 'Prometheus holds no Agent Substrate series, so resume latency, failed resumes and crash rates are unknown.'}>Unavailable · no Substrate series</Unread>,
|
|
247
|
+
tone: 'unknown',
|
|
248
|
+
})
|
|
249
|
+
} else {
|
|
250
|
+
const resume = [
|
|
251
|
+
svc.slowestResume && `slowest p95 ${secs(svc.slowestResume.value)} on ${svc.slowestResume.pool.name}`,
|
|
252
|
+
svc.mostFailedResumes && svc.mostFailedResumes.value > 0 && `${pct(svc.mostFailedResumes.value)} failed on ${svc.mostFailedResumes.pool.name}`,
|
|
253
|
+
].filter(Boolean)
|
|
254
|
+
facts.push({
|
|
255
|
+
label: `Resumes (${window})`,
|
|
256
|
+
value: resume.length ? resume.join(', ') : <Unread>unknown</Unread>,
|
|
257
|
+
tone: !resume.length ? 'unknown' : svc.mostFailedResumes && svc.mostFailedResumes.value > 0 ? 'degraded' : 'healthy',
|
|
258
|
+
title: 'From Substrate’s Prometheus metrics, over resumes placed on a pool. A resume that fails before placement names no pool and is not counted.',
|
|
259
|
+
lowerBound: resume.length > 0 && svc.poolsUnknown > 0,
|
|
260
|
+
})
|
|
261
|
+
const crashes = svc.crashes !== undefined ? Math.round(svc.crashes) : undefined
|
|
262
|
+
const partialZero = crashes === 0 && svc.poolsUnknown > 0
|
|
263
|
+
facts.push({
|
|
264
|
+
label: `Crashes (${window})`,
|
|
265
|
+
value: crashes !== undefined && !partialZero ? countText(crashes) : <Unread>unknown</Unread>,
|
|
266
|
+
tone: partialZero ? 'unknown' : (crashes ?? 0) > 0 || crashedNow > 0 ? 'unhealthy' : crashes === undefined ? 'unknown' : 'healthy',
|
|
267
|
+
title: crashedNow > 0 && (crashes ?? 0) === 0 ? `Prometheus counts ${crashes ?? 'no'} crashes in the last ${window}; Substrate’s API lists ${crashedNow} crashed ${crashedNow === 1 ? 'actor' : 'actors'} now.` : undefined,
|
|
268
|
+
lowerBound: (crashes ?? 0) > 0 && svc.poolsUnknown > 0,
|
|
269
|
+
})
|
|
270
|
+
}
|
|
271
|
+
if (unstored > 0) {
|
|
272
|
+
// The tone of the worst upload row: alert while the nodes are up, critical once one holding them is down.
|
|
273
|
+
const worst = worstAttentionTone(uploadRows) ?? 'degraded'
|
|
274
|
+
facts.push({
|
|
275
|
+
label: 'Uploads',
|
|
276
|
+
value: `${countText(unstored)} ${unstored === 1 ? 'snapshot' : 'snapshots'} not stored yet`,
|
|
277
|
+
tone: worst,
|
|
278
|
+
title: svc.nodesOverdue > 0 ? `Substrate actor snapshots · atelet metrics show overdue uploads on ${svc.nodesOverdue} ${svc.nodesOverdue === 1 ? 'node' : 'nodes'}` : 'From suspended actor snapshots in Substrate',
|
|
279
|
+
})
|
|
280
|
+
} else if (svc.read && svc.nodesOverdue > 0) {
|
|
281
|
+
facts.push({
|
|
282
|
+
label: 'Uploads',
|
|
283
|
+
value: `overdue on ${svc.nodesOverdue} ${svc.nodesOverdue === 1 ? 'node' : 'nodes'}`,
|
|
284
|
+
tone: worstAttentionTone(uploadRows) ?? 'alert',
|
|
285
|
+
title: 'atelet’s own count of snapshot uploads past their deadline.',
|
|
286
|
+
lowerBound: svc.nodesUnknown > 0,
|
|
287
|
+
})
|
|
288
|
+
}
|
|
289
|
+
return facts
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/** The pool's one reading, the same as its page header: Substrate's verdict, Kubernetes' phase beneath. */
|
|
293
|
+
export function PoolReadingCell({ p, finding }: { p: SubstratePoolRow; finding?: SubstrateAttention }) {
|
|
294
|
+
const r = poolReading(p, finding)
|
|
295
|
+
return (
|
|
296
|
+
<>
|
|
297
|
+
<Tooltip content={r.kubernetes ? `${r.meaning} Kubernetes: ${r.kubernetes}.` : r.meaning}><span><Badge severity={r.severity} size="sm" className="whitespace-normal text-left">{r.label}</Badge></span></Tooltip>
|
|
298
|
+
{/* Kubernetes' own verdict earns a line only when it explains a problem. */}
|
|
299
|
+
{p.kubernetes?.healthDetail && <Sub>{p.kubernetes.healthReason === 'Provisioning stalled' ? 'No Deployment reported' : p.kubernetes.healthDetail}</Sub>}
|
|
300
|
+
{!p.kubernetes?.healthDetail && finding && p.capacity !== 'short' && <Sub>{finding.reading.split('. ')[0]}</Sub>}
|
|
301
|
+
</>
|
|
302
|
+
)
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function WorkersCell({ p }: { p: SubstratePoolRow }) {
|
|
306
|
+
const desired = p.kubernetes?.desired
|
|
307
|
+
if (p.placement) {
|
|
308
|
+
const w = p.placement.workers
|
|
309
|
+
if (!p.placement.complete && w.active === 0) return <Unread>Unknown</Unread>
|
|
310
|
+
const notes = [w.draining > 0 && `${w.draining} draining`, w.unavailable > 0 && `${w.unavailable} unavailable`].filter(Boolean)
|
|
311
|
+
return (
|
|
312
|
+
<>
|
|
313
|
+
<span className="inline-flex items-center gap-1 whitespace-nowrap">
|
|
314
|
+
{!p.placement.complete && <CertaintyGlyph certainty="lower_bound" title="At least: Radar read only part of Substrate’s workers" />}
|
|
315
|
+
{w.active} active{desired !== undefined ? ` of ${desired}` : ''}
|
|
316
|
+
</span>
|
|
317
|
+
{notes.length > 0 && <Sub>{notes.join(' · ')}</Sub>}
|
|
318
|
+
</>
|
|
319
|
+
)
|
|
320
|
+
}
|
|
321
|
+
return <Unread>Unknown</Unread>
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
export function slotsOffActive(p: SubstratePoolRow, actorsPartial: boolean): number {
|
|
325
|
+
if (actorsPartial || !p.placement?.complete || p.actors === undefined || p.placement.workers.draining + p.placement.workers.unavailable === 0) return 0
|
|
326
|
+
return p.actors - p.placement.slots.used
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
export function SlotsCell({ p, connected, inline, actorsPartial }: { p: SubstratePoolRow; connected: boolean; inline?: boolean; actorsPartial: boolean }) {
|
|
330
|
+
const placement = p.placement
|
|
331
|
+
if (!placement) return <Unread title={NOT_CONNECTED_TITLE}>{connected ? 'Unknown' : 'Not connected'}</Unread>
|
|
332
|
+
const s = placement.slots
|
|
333
|
+
if (s.total === 0) return placement.complete
|
|
334
|
+
? <Tooltip content="No active worker of this pool has an actor slot, so Substrate places no actors here."><span>0 slots</span></Tooltip>
|
|
335
|
+
: <Unread>Unknown</Unread>
|
|
336
|
+
const elsewhere = slotsOffActive(p, actorsPartial)
|
|
337
|
+
return (
|
|
338
|
+
<>
|
|
339
|
+
<span className="inline-flex items-center gap-1 whitespace-nowrap">
|
|
340
|
+
{!placement.complete && s.used > 0 && <CertaintyGlyph certainty="lower_bound" title="At least: Radar read only part of Substrate’s workers" />}
|
|
341
|
+
{placement.complete ? `${s.used} of ${s.total} used` : `${s.used === 0 ? 'Usage unknown' : `${s.used} used`} · ≥${s.total} slots`}
|
|
342
|
+
</span>
|
|
343
|
+
{!inline && elsewhere > 0 && <Sub>+{elsewhere} on non-active workers</Sub>}
|
|
344
|
+
</>
|
|
345
|
+
)
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export function PoolsTable({ data, onInspect, inspected }: {
|
|
349
|
+
data: SubstrateWorkspace
|
|
350
|
+
onInspect: (resource: SelectedResource) => void
|
|
351
|
+
inspected: SelectedResource | null
|
|
352
|
+
}) {
|
|
353
|
+
const navigate = useWorkspaceNavigate()
|
|
354
|
+
const [search, setSearch] = useState('')
|
|
355
|
+
const [filter, setFilter] = useState<'all' | 'attention' | 'free'>('all')
|
|
356
|
+
const findings = new Map(data.needsAttention
|
|
357
|
+
.filter((f) => f.subject.kind === 'WorkerPool' && f.severity !== 'info')
|
|
358
|
+
.map((f) => [`${f.subject.namespace}/${f.subject.name}`, f]))
|
|
359
|
+
const key = (p: SubstratePoolRow) => `${p.namespace}/${p.name}`
|
|
360
|
+
const finding = (p: SubstratePoolRow) => findings.get(key(p))
|
|
361
|
+
const rank = (p: SubstratePoolRow) => {
|
|
362
|
+
const ranks = { error: 0, alert: 1, warning: 2, info: 3, neutral: 3, success: 4 }
|
|
363
|
+
return ranks[poolReading(p, finding(p)).severity]
|
|
364
|
+
}
|
|
365
|
+
const scoped = data.pools.filter((p) => key(p).toLowerCase().includes(search.trim().toLowerCase()))
|
|
366
|
+
const needsAttention = (p: SubstratePoolRow) => !!finding(p)
|
|
367
|
+
const free = (p: SubstratePoolRow) => p.capacity === 'free' && !needsAttention(p)
|
|
368
|
+
const rows = scoped.filter((p) => filter === 'all' || (filter === 'attention' ? needsAttention(p) : free(p)))
|
|
369
|
+
.sort((a, b) => rank(a) - rank(b) || key(a).localeCompare(key(b)))
|
|
370
|
+
const partial = INCOMPLETE_COVERAGE_STATES.has(data.coverage.pools.state) || coverageInPart(data.coverage.workers)
|
|
371
|
+
const count = (n: number) => partial ? n > 0 ? `≥${n}` : undefined : n
|
|
372
|
+
const namespaces = [...new Set(data.pools.map((p) => p.namespace))]
|
|
373
|
+
const oneNamespace = namespaces.length === 1 ? namespaces[0] : undefined
|
|
374
|
+
const openWorkers = (p: SubstratePoolRow) => navigate(`${SUBSTRATE_SCREENS.workers.path}?${new URLSearchParams({ pool: key(p) })}`)
|
|
375
|
+
const columns: TableColumn<SubstratePoolRow>[] = [
|
|
376
|
+
{
|
|
377
|
+
header: 'Pool',
|
|
378
|
+
width: '21%',
|
|
379
|
+
cell: (p) => (
|
|
380
|
+
<>
|
|
381
|
+
<Name name={p.name} />
|
|
382
|
+
{!oneNamespace && <Sub>{p.namespace}</Sub>}
|
|
383
|
+
{!p.kubernetes && <Sub>Named by Substrate workers</Sub>}
|
|
384
|
+
</>
|
|
385
|
+
),
|
|
386
|
+
},
|
|
387
|
+
{ header: 'Workers accepting actors', width: '18%', cell: (p) => <WorkersCell p={p} /> },
|
|
388
|
+
{ header: 'Slots on active workers', width: '17%', cell: (p) => <SlotsCell p={p} connected={data.apiTier.state === 'connected'} actorsPartial={coverageInPart(data.coverage.actors)} /> },
|
|
389
|
+
{
|
|
390
|
+
header: 'Kubernetes readiness',
|
|
391
|
+
width: '19%',
|
|
392
|
+
cell: ({ kubernetes: k }) => k
|
|
393
|
+
? <>{k.reportedReady === undefined ? 'Ready replicas unreported' : `${k.reportedReady} ready · controller`}{k.pods && <Sub>{k.pods.created === 0 ? '0 Pods observed' : `${k.pods.ready} of ${k.pods.created} observed ${k.pods.created === 1 ? 'Pod' : 'Pods'} ready`}</Sub>}</>
|
|
394
|
+
: <Unread>WorkerPool not read</Unread>,
|
|
395
|
+
},
|
|
396
|
+
{ header: 'Needs attention', cell: (p) => <PoolReadingCell p={p} finding={finding(p)} /> },
|
|
397
|
+
{
|
|
398
|
+
header: <span className="sr-only">Open pool</span>,
|
|
399
|
+
width: '76px',
|
|
400
|
+
cell: (p) => (
|
|
401
|
+
<button type="button" aria-label={p.kubernetes ? `Open pool ${p.name}` : `Open workers for ${p.name}`} onClick={(e) => {
|
|
402
|
+
e.stopPropagation()
|
|
403
|
+
if (p.kubernetes) onInspect(refToSelectedResource({ kind: 'WorkerPool', group: SUBSTRATE_GROUP, namespace: p.namespace, name: p.name }))
|
|
404
|
+
else openWorkers(p)
|
|
405
|
+
}} className="whitespace-nowrap text-xs text-accent-text hover:underline">Open →</button>
|
|
406
|
+
),
|
|
407
|
+
},
|
|
408
|
+
]
|
|
409
|
+
const empty = data.coverage.pools.state === 'notInstalled' ? 'The WorkerPool kind is not installed.' : coverageEmpty(data.coverage.pools, 'WorkerPools')
|
|
410
|
+
return (
|
|
411
|
+
<>
|
|
412
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
413
|
+
<Segments label="Pool filter" value={filter} onChange={setFilter} options={[
|
|
414
|
+
{ id: 'all', label: 'All', count: count(scoped.length) }, { id: 'attention', label: 'Needs attention', count: count(scoped.filter(needsAttention).length) }, { id: 'free', label: 'Free slots', count: count(scoped.filter(free).length) },
|
|
415
|
+
]} />
|
|
416
|
+
<Input aria-label="Search pools" placeholder="Search pools…" value={search} onChange={(e) => setSearch(e.target.value)} className="h-8 max-w-52 rounded-md border border-theme-border bg-theme-elevated px-3" />
|
|
417
|
+
</div>
|
|
418
|
+
<SectionTable
|
|
419
|
+
subtitle={oneNamespace ? <>Namespace: <span className="font-mono">{oneNamespace}</span></> : undefined}
|
|
420
|
+
columns={columns}
|
|
421
|
+
rows={rows}
|
|
422
|
+
rowKey={key}
|
|
423
|
+
rowResource={(p) => refToSelectedResource({ kind: 'WorkerPool', group: SUBSTRATE_GROUP, namespace: p.namespace, name: p.name })}
|
|
424
|
+
onInspect={(res) => {
|
|
425
|
+
const p = rows.find((row) => row.namespace === res.namespace && row.name === res.name)
|
|
426
|
+
if (p?.kubernetes) onInspect(res)
|
|
427
|
+
else if (p) openWorkers(p)
|
|
428
|
+
}}
|
|
429
|
+
inspected={inspected}
|
|
430
|
+
empty={data.pools.length && !rows.length ? 'No pools match these filters.' : empty}
|
|
431
|
+
minWidth={850}
|
|
432
|
+
footer={INCOMPLETE_COVERAGE_STATES.has(data.coverage.pools.state) ? `WorkerPools Radar couldn’t read are not listed: ${coverageLabel(data.coverage.pools)}.` : undefined}
|
|
433
|
+
/>
|
|
434
|
+
</>
|
|
435
|
+
)
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
type AtespaceRow = NonNullable<SubstrateWorkspace['atespaces']>[number]
|
|
439
|
+
|
|
440
|
+
/** One atespace's count of a kind: a lower bound when only part was read, and no number when none was. */
|
|
441
|
+
function AtespaceCount({ read, count, noun }: { read: SubstrateAtespaceRead; count?: number; noun: string }) {
|
|
442
|
+
if (read === 'denied') return <Unread title={`Substrate denied reading this atespace’s ${noun}.`}>No access</Unread>
|
|
443
|
+
if (read === 'partial' && count === 0) return <Unread title={`Radar found no ${noun} in the part of this atespace it could read.`}>Unknown</Unread>
|
|
444
|
+
if (read === 'unread' || count === undefined) return <Unread title={`Radar didn’t read this atespace’s ${noun}: the read’s budget ran out first, or the connection’s atespaces don’t name it.`}>not read</Unread>
|
|
445
|
+
return (
|
|
446
|
+
<span className="inline-flex items-center gap-1">
|
|
447
|
+
{read === 'partial' && <CertaintyGlyph certainty="lower_bound" title={`At least: Radar read only part of this atespace’s ${noun}`} />}
|
|
448
|
+
{countText(count)}
|
|
449
|
+
</span>
|
|
450
|
+
)
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
function AtespacesTable({ data }: { data: SubstrateWorkspace }) {
|
|
454
|
+
const navigate = useWorkspaceNavigate()
|
|
455
|
+
if (!data.atespaces) return null
|
|
456
|
+
const columns: TableColumn<AtespaceRow>[] = [
|
|
457
|
+
{ header: 'Atespace', cell: (a) => <Name name={a.name} /> },
|
|
458
|
+
{ header: 'Actors', width: '100px', cell: (a) => <AtespaceCount read={a.actorsRead} count={a.actors?.total} noun="actors" /> },
|
|
459
|
+
{ header: 'States', width: '200px', cell: (a) => (a.actors ? <div className="pt-1.5"><SubstrateStateBar counts={a.actors} compact /></div> : <Unread>—</Unread>) },
|
|
460
|
+
{ header: 'Templates', width: '100px', cell: (a) => <AtespaceCount read={a.templatesRead} count={a.templates} noun="templates" /> },
|
|
461
|
+
{
|
|
462
|
+
header: 'Crashed',
|
|
463
|
+
width: '90px',
|
|
464
|
+
cell: (a) => {
|
|
465
|
+
if (!a.actors) return <Unread>—</Unread>
|
|
466
|
+
const n = a.actors.byState.crashed
|
|
467
|
+
const partial = a.actorsRead === 'partial'
|
|
468
|
+
if (partial && n === 0) return <Unread>Unknown</Unread>
|
|
469
|
+
return (
|
|
470
|
+
<span className={`inline-flex items-center gap-1 ${n > 0 ? `font-medium ${toneTextClass('unhealthy')}` : 'text-theme-text-tertiary'}`}>
|
|
471
|
+
{partial && <CertaintyGlyph certainty="lower_bound" title="At least: Radar read only part of this atespace’s actors" />}
|
|
472
|
+
{n}
|
|
473
|
+
</span>
|
|
474
|
+
)
|
|
475
|
+
},
|
|
476
|
+
},
|
|
477
|
+
]
|
|
478
|
+
return (
|
|
479
|
+
<section>
|
|
480
|
+
<SectionTable
|
|
481
|
+
title={<Term term="atespace">Atespaces</Term>}
|
|
482
|
+
subtitle="Open one to see its actors."
|
|
483
|
+
columns={columns}
|
|
484
|
+
rows={[...data.atespaces].sort((a, b) => (b.actors?.byState.crashed ?? 0) - (a.actors?.byState.crashed ?? 0) || a.name.localeCompare(b.name))}
|
|
485
|
+
rowKey={(a) => a.name}
|
|
486
|
+
// Not a Kubernetes object: the row opens the Actors list narrowed to it.
|
|
487
|
+
rowResource={(a) => ({ kind: 'Atespace', namespace: '', name: a.name })}
|
|
488
|
+
onInspect={(res) => navigate(substrateActorsPath({ atespace: res.name }))}
|
|
489
|
+
empty={coverageInPart(data.coverage?.atespaces) ? 'Atespaces could not be read.' : 'No atespaces.'}
|
|
490
|
+
minWidth={640}
|
|
491
|
+
/>
|
|
492
|
+
</section>
|
|
493
|
+
)
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
export function SubstrateOverview({ data, status, onOpenSubject }: SubstrateOverviewProps) {
|
|
497
|
+
const navigate = useWorkspaceNavigate()
|
|
498
|
+
const tier = data.apiTier
|
|
499
|
+
const [pools, workers, slots, actors, templates, ...service] = overviewFacts(data)
|
|
500
|
+
const uploads = service.find((f) => f.label === 'Uploads')
|
|
501
|
+
const delivery = service.filter((f) => f !== uploads)
|
|
502
|
+
const uploadCheck = data.checks.find((c) => c.rule === 'uploadOverdue')
|
|
503
|
+
const uploadsInPart = coverageInPart(data.coverage.actors)
|
|
504
|
+
const uploadReading: Fact = uploads ?? {
|
|
505
|
+
label: 'Uploads',
|
|
506
|
+
value: uploadCheck?.ran && !uploadsInPart ? 'No overdue uploads found' : 'Unknown',
|
|
507
|
+
tone: uploadCheck?.ran && !uploadsInPart ? 'healthy' as const : 'unknown' as const,
|
|
508
|
+
}
|
|
509
|
+
const uploadRow = data.needsAttention.find((f) => f.rule === 'uploadOverdue')
|
|
510
|
+
const actorsExtra = data.summary.actors && data.needsAttention.some((a) => a.rule === 'goldenSnapshotFailed') && !coverageInPart(data.coverage.templates)
|
|
511
|
+
? data.summary.actors.crashed - (data.needsAttention.find((f) => f.rule === 'crashedActors')?.count ?? 0)
|
|
512
|
+
: 0
|
|
513
|
+
return (
|
|
514
|
+
<div className="flex min-h-0 flex-1 flex-col">
|
|
515
|
+
<SubstrateHeader title="Overview" intro="Cluster-wide" />
|
|
516
|
+
<ScreenBody>
|
|
517
|
+
<SubstrateTierBanner tier={tier} />
|
|
518
|
+
{showsConnectNotice(tier) && <SubstrateConnectNotice status={status} tier={tier} />}
|
|
519
|
+
<SubstrateCoverageNotice coverage={data.coverage} kinds={['actors', 'templates', 'workers', 'atespaces']} />
|
|
520
|
+
<SubstrateRefreshFailure tier={tier} notice />
|
|
521
|
+
<WorkspaceCard title="Needs attention">
|
|
522
|
+
{data.needsAttention.length > 0 && <p className="text-xs text-theme-text-tertiary">Findings can group several actors. Each inventory counts individual objects in its Needs attention filter.</p>}
|
|
523
|
+
{data.needsAttention.length > 0 && <SubstrateAttentionList rows={data.needsAttention} onOpen={onOpenSubject} />}
|
|
524
|
+
<ChecksSummary data={data} empty={data.needsAttention.length === 0} />
|
|
525
|
+
</WorkspaceCard>
|
|
526
|
+
<WorkspaceCard title="At a glance">
|
|
527
|
+
<FactGrid>
|
|
528
|
+
<FactRow label="Actors">
|
|
529
|
+
<DimensionValue tone={actors.tone} source={actorsExtra > 0 ? `Reported phases from Substrate · ${actorsExtra} failed golden ${actorsExtra === 1 ? 'build is' : 'builds are'} tracked under Templates` : 'Reported phases from Substrate'} linkLabel="Actors" onOpen={() => navigate(SUBSTRATE_SCREENS.actors.path)}>
|
|
530
|
+
<FleetValue fact={actors} />
|
|
531
|
+
</DimensionValue>
|
|
532
|
+
</FactRow>
|
|
533
|
+
<FactRow label="Worker capacity">
|
|
534
|
+
<DimensionValue
|
|
535
|
+
tone={worseTone(pools.tone, workers.tone)}
|
|
536
|
+
source={<>
|
|
537
|
+
<div className={`text-sm ${toneTextClass(slots.tone)}`}><FleetValue fact={slots} /></div>
|
|
538
|
+
<div>Kubernetes WorkerPools and Substrate API</div>
|
|
539
|
+
</>}
|
|
540
|
+
linkLabel="Pools"
|
|
541
|
+
onOpen={() => navigate(SUBSTRATE_POOLS_PATH)}
|
|
542
|
+
>
|
|
543
|
+
<FleetValue fact={pools} /> · <FleetValue fact={workers} />
|
|
544
|
+
</DimensionValue>
|
|
545
|
+
</FactRow>
|
|
546
|
+
<FactRow label="Template startup">
|
|
547
|
+
<DimensionValue tone={templates.tone} source="Template records from Substrate" linkLabel="Templates" onOpen={() => navigate(SUBSTRATE_SCREENS.templates.path)}>
|
|
548
|
+
<FleetValue fact={templates} />
|
|
549
|
+
</DimensionValue>
|
|
550
|
+
</FactRow>
|
|
551
|
+
<FactRow label="Snapshot uploads">
|
|
552
|
+
<DimensionValue tone={uploadReading.tone} source={uploadReading.title ?? (uploadCheck?.why || 'Latest suspended snapshots from Substrate')} linkLabel="View all suspended actors" onOpen={uploadRow ? () => onOpenSubject(uploadRow.subject) : undefined}>
|
|
553
|
+
<FleetValue fact={{ ...uploadReading, lowerBound: uploadsInPart && !!uploadRow }} />
|
|
554
|
+
</DimensionValue>
|
|
555
|
+
</FactRow>
|
|
556
|
+
<FactRow label="Delivery metrics">
|
|
557
|
+
<DimensionValue tone={delivery.reduce<StatusTone>((tone, f) => worseTone(tone, f.tone), delivery[0].tone)} source={data.service.why || `Substrate Prometheus series · last ${data.service.window ?? '1h'}`}>
|
|
558
|
+
{delivery.map((f, i) => <Fragment key={i}>{i > 0 && ' · '}{delivery.length > 1 && <>{f.label}: </>}<FleetValue fact={f} /></Fragment>)}
|
|
559
|
+
</DimensionValue>
|
|
560
|
+
</FactRow>
|
|
561
|
+
</FactGrid>
|
|
562
|
+
</WorkspaceCard>
|
|
563
|
+
<WorkspaceCard>
|
|
564
|
+
<FoldSection title="Coverage and connection" summary={data.atespaces ? 'Atespaces, data sources and connection settings' : 'Data sources and connection settings'} attention={false}>
|
|
565
|
+
<div className="space-y-3">
|
|
566
|
+
<SubstrateSourceLine tier={tier} status={status} showRefreshFailure={false} />
|
|
567
|
+
<SubstrateConnectionLink status={status} />
|
|
568
|
+
<AtespacesTable data={data} />
|
|
569
|
+
</div>
|
|
570
|
+
</FoldSection>
|
|
571
|
+
</WorkspaceCard>
|
|
572
|
+
</ScreenBody>
|
|
573
|
+
</div>
|
|
574
|
+
)
|
|
575
|
+
}
|