Skip to content

Commit 99893ff

Browse files
committed
WIP
1 parent ee8bd1b commit 99893ff

File tree

5 files changed

+77
-54
lines changed

5 files changed

+77
-54
lines changed

site/src/api/api.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -1557,12 +1557,13 @@ export const getInsightsTemplate = async (
15571557

15581558
export interface Health {
15591559
healthy: boolean;
1560+
warning: boolean;
15601561
time: string;
15611562
coder_version: string;
1562-
access_url: { healthy: boolean };
1563-
database: { healthy: boolean };
1564-
derp: { healthy: boolean };
1565-
websocket: { healthy: boolean };
1563+
access_url: { healthy: boolean; warning: boolean };
1564+
database: { healthy: boolean; warning: boolean };
1565+
derp: { healthy: boolean; warning: boolean };
1566+
websocket: { healthy: boolean; warning: boolean };
15661567
}
15671568

15681569
export const getHealth = async () => {

site/src/api/typesGenerated.ts

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/src/pages/HealthPage/HealthPage.stories.tsx

+13
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,16 @@ export const UnhealthyDERP: Story = {
3131
},
3232
},
3333
};
34+
35+
export const HealthyDERPWithWarning: Story = {
36+
args: {
37+
healthStatus: {
38+
...MockHealth,
39+
warning: true,
40+
derp: {
41+
...MockHealth.derp,
42+
warning: true,
43+
},
44+
},
45+
},
46+
};

site/src/pages/HealthPage/HealthPage.tsx

+22-9
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ export function HealthPageView({
8585
</PageHeaderTitle>
8686
<PageHeaderSubtitle>
8787
{healthStatus.healthy
88-
? "All systems operational"
88+
? healthStatus.warning
89+
? "All systems operational, but performance might be degraded"
90+
: "All systems operational"
8991
: "Some issues have been detected"}
9092
</PageHeaderSubtitle>
9193
</div>
@@ -139,7 +141,8 @@ export function HealthPageView({
139141
const isActive = tab.value === key;
140142
const isHealthy =
141143
healthStatus[key as keyof typeof sections].healthy;
142-
144+
const isWarning =
145+
healthStatus[key as keyof typeof sections].warning;
143146
return (
144147
<Box
145148
component="button"
@@ -171,13 +174,23 @@ export function HealthPageView({
171174
}}
172175
>
173176
{isHealthy ? (
174-
<CheckCircleOutlined
175-
sx={{
176-
width: 16,
177-
height: 16,
178-
color: (theme) => theme.palette.success.light,
179-
}}
180-
/>
177+
isWarning ? (
178+
<CheckCircleOutlined
179+
sx={{
180+
width: 16,
181+
height: 16,
182+
color: (theme) => theme.palette.warning.main,
183+
}}
184+
/>
185+
) : (
186+
<CheckCircleOutlined
187+
sx={{
188+
width: 16,
189+
height: 16,
190+
color: (theme) => theme.palette.success.light,
191+
}}
192+
/>
193+
)
181194
) : (
182195
<ErrorOutline
183196
sx={{

site/src/testHelpers/entities.ts

+36-40
Original file line numberDiff line numberDiff line change
@@ -2385,15 +2385,18 @@ export const MockLicenseResponse: GetLicensesResponse[] = [
23852385
},
23862386
];
23872387

2388-
export const MockHealth = {
2388+
export const MockHealth: TypesGen.HealthcheckReport = {
23892389
time: "2023-08-01T16:51:03.29792825Z",
23902390
healthy: true,
2391-
failing_sections: null,
2391+
warning: false,
2392+
failing_sections: [],
23922393
derp: {
23932394
healthy: true,
2395+
warning: false,
23942396
regions: {
23952397
"999": {
23962398
healthy: true,
2399+
warning: false,
23972400
region: {
23982401
EmbeddedRelay: true,
23992402
RegionID: 999,
@@ -2419,6 +2422,7 @@ export const MockHealth = {
24192422
node_reports: [
24202423
{
24212424
healthy: true,
2425+
warning: false,
24222426
node: {
24232427
Name: "999stun0",
24242428
RegionID: 999,
@@ -2431,19 +2435,19 @@ export const MockHealth = {
24312435
TokenBucketBytesBurst: 0,
24322436
},
24332437
can_exchange_messages: false,
2434-
round_trip_ping: 0,
2438+
round_trip_ping: "0",
2439+
round_trip_ping_ms: 0,
24352440
uses_websocket: false,
24362441
client_logs: [],
24372442
client_errs: [],
2438-
error: null,
24392443
stun: {
24402444
Enabled: true,
24412445
CanSTUN: true,
2442-
Error: null,
24432446
},
24442447
},
24452448
{
24462449
healthy: true,
2450+
warning: false,
24472451
node: {
24482452
Name: "999b",
24492453
RegionID: 999,
@@ -2456,7 +2460,8 @@ export const MockHealth = {
24562460
TokenBucketBytesBurst: 0,
24572461
},
24582462
can_exchange_messages: true,
2459-
round_trip_ping: 7674330,
2463+
round_trip_ping: "7674330",
2464+
round_trip_ping_ms: 7674330,
24602465
uses_websocket: false,
24612466
client_logs: [
24622467
[
@@ -2467,18 +2472,16 @@ export const MockHealth = {
24672472
],
24682473
],
24692474
client_errs: [[], []],
2470-
error: null,
24712475
stun: {
24722476
Enabled: false,
24732477
CanSTUN: false,
2474-
Error: null,
24752478
},
24762479
},
24772480
],
2478-
error: null,
24792481
},
24802482
"10007": {
24812483
healthy: true,
2484+
warning: false,
24822485
region: {
24832486
EmbeddedRelay: false,
24842487
RegionID: 10007,
@@ -2504,6 +2507,7 @@ export const MockHealth = {
25042507
node_reports: [
25052508
{
25062509
healthy: true,
2510+
warning: false,
25072511
node: {
25082512
Name: "10007stun0",
25092513
RegionID: 10007,
@@ -2516,19 +2520,19 @@ export const MockHealth = {
25162520
TokenBucketBytesBurst: 0,
25172521
},
25182522
can_exchange_messages: false,
2519-
round_trip_ping: 0,
2523+
round_trip_ping: "0",
2524+
round_trip_ping_ms: 0,
25202525
uses_websocket: false,
25212526
client_logs: [],
25222527
client_errs: [],
2523-
error: null,
25242528
stun: {
25252529
Enabled: true,
25262530
CanSTUN: true,
2527-
Error: null,
25282531
},
25292532
},
25302533
{
25312534
healthy: true,
2535+
warning: false,
25322536
node: {
25332537
Name: "10007a",
25342538
RegionID: 10007,
@@ -2541,7 +2545,8 @@ export const MockHealth = {
25412545
TokenBucketBytesBurst: 0,
25422546
},
25432547
can_exchange_messages: true,
2544-
round_trip_ping: 170527034,
2548+
round_trip_ping: "170527034",
2549+
round_trip_ping_ms: 170527034,
25452550
uses_websocket: false,
25462551
client_logs: [
25472552
[
@@ -2552,18 +2557,16 @@ export const MockHealth = {
25522557
],
25532558
],
25542559
client_errs: [[], []],
2555-
error: null,
25562560
stun: {
25572561
Enabled: false,
25582562
CanSTUN: false,
2559-
Error: null,
25602563
},
25612564
},
25622565
],
2563-
error: null,
25642566
},
25652567
"10008": {
25662568
healthy: true,
2569+
warning: false,
25672570
region: {
25682571
EmbeddedRelay: false,
25692572
RegionID: 10008,
@@ -2589,6 +2592,7 @@ export const MockHealth = {
25892592
node_reports: [
25902593
{
25912594
healthy: true,
2595+
warning: false,
25922596
node: {
25932597
Name: "10008stun0",
25942598
RegionID: 10008,
@@ -2601,19 +2605,19 @@ export const MockHealth = {
26012605
TokenBucketBytesBurst: 0,
26022606
},
26032607
can_exchange_messages: false,
2604-
round_trip_ping: 0,
2608+
round_trip_ping: "0",
2609+
round_trip_ping_ms: 0,
26052610
uses_websocket: false,
26062611
client_logs: [],
26072612
client_errs: [],
2608-
error: null,
26092613
stun: {
26102614
Enabled: true,
26112615
CanSTUN: true,
2612-
Error: null,
26132616
},
26142617
},
26152618
{
26162619
healthy: true,
2620+
warning: false,
26172621
node: {
26182622
Name: "10008a",
26192623
RegionID: 10008,
@@ -2626,7 +2630,8 @@ export const MockHealth = {
26262630
TokenBucketBytesBurst: 0,
26272631
},
26282632
can_exchange_messages: true,
2629-
round_trip_ping: 111329690,
2633+
round_trip_ping: "111329690",
2634+
round_trip_ping_ms: 111329690,
26302635
uses_websocket: false,
26312636
client_logs: [
26322637
[
@@ -2637,18 +2642,16 @@ export const MockHealth = {
26372642
],
26382643
],
26392644
client_errs: [[], []],
2640-
error: null,
26412645
stun: {
26422646
Enabled: false,
26432647
CanSTUN: false,
2644-
Error: null,
26452648
},
26462649
},
26472650
],
2648-
error: null,
26492651
},
26502652
"10009": {
26512653
healthy: true,
2654+
warning: false,
26522655
region: {
26532656
EmbeddedRelay: false,
26542657
RegionID: 10009,
@@ -2674,6 +2677,7 @@ export const MockHealth = {
26742677
node_reports: [
26752678
{
26762679
healthy: true,
2680+
warning: false,
26772681
node: {
26782682
Name: "10009stun0",
26792683
RegionID: 10009,
@@ -2686,19 +2690,19 @@ export const MockHealth = {
26862690
TokenBucketBytesBurst: 0,
26872691
},
26882692
can_exchange_messages: false,
2689-
round_trip_ping: 0,
2693+
round_trip_ping: "0",
2694+
round_trip_ping_ms: 0,
26902695
uses_websocket: false,
26912696
client_logs: [],
26922697
client_errs: [],
2693-
error: null,
26942698
stun: {
26952699
Enabled: true,
26962700
CanSTUN: true,
2697-
Error: null,
26982701
},
26992702
},
27002703
{
27012704
healthy: true,
2705+
warning: false,
27022706
node: {
27032707
Name: "10009a",
27042708
RegionID: 10009,
@@ -2711,7 +2715,8 @@ export const MockHealth = {
27112715
TokenBucketBytesBurst: 0,
27122716
},
27132717
can_exchange_messages: true,
2714-
round_trip_ping: 138185506,
2718+
round_trip_ping: "138185506",
2719+
round_trip_ping_ms: 138185506,
27152720
uses_websocket: false,
27162721
client_logs: [
27172722
[
@@ -2722,15 +2727,12 @@ export const MockHealth = {
27222727
],
27232728
],
27242729
client_errs: [[], []],
2725-
error: null,
27262730
stun: {
27272731
Enabled: false,
27282732
CanSTUN: false,
2729-
Error: null,
27302733
},
27312734
},
27322735
],
2733-
error: null,
27342736
},
27352737
},
27362738
netcheck: {
@@ -2764,7 +2766,6 @@ export const MockHealth = {
27642766
GlobalV6: "",
27652767
CaptivePortal: null,
27662768
},
2767-
netcheck_err: null,
27682769
netcheck_logs: [
27692770
"netcheck: netcheck.runProbe: got STUN response for 10007stun0 from 34.71.26.24:55368 (9b07930007da49dd7df79bc7) in 1.791799ms",
27702771
"netcheck: netcheck.runProbe: got STUN response for 999stun0 from 34.71.26.24:55368 (7397fec097f1d5b01364566b) in 1.791529ms",
@@ -2777,29 +2778,24 @@ export const MockHealth = {
27772778
"netcheck: [v1] measureAllICMPLatency: listen ip4:icmp 0.0.0.0: socket: operation not permitted",
27782779
"netcheck: [v1] report: udp=true v6=false v6os=true mapvarydest=false hair= portmap= v4a=34.71.26.24:55368 derp=999 derpdist=999v4:2ms,10007v4:175ms,10008v4:112ms,10009v4:139ms",
27792780
],
2780-
error: null,
27812781
},
27822782
access_url: {
27832783
access_url: "https://dev.coder.com",
27842784
healthy: true,
27852785
reachable: true,
27862786
status_code: 200,
27872787
healthz_response: "OK",
2788-
error: null,
27892788
},
27902789
websocket: {
27912790
healthy: true,
2792-
response: {
2793-
body: "",
2794-
code: 101,
2795-
},
2796-
error: null,
2791+
body: "",
2792+
code: 101,
27972793
},
27982794
database: {
27992795
healthy: true,
28002796
reachable: true,
2801-
latency: 92570,
2802-
error: null,
2797+
latency: "92570",
2798+
latency_ms: 92570,
28032799
},
28042800
coder_version: "v0.27.1-devel+c575292",
28052801
};

0 commit comments

Comments
 (0)