Skip to content

feat: show health check warnings #10620

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
WIP
  • Loading branch information
mtojek committed Nov 10, 2023
commit 99893ff5a6672cc3b32f20d27f3abf950df1c53a
9 changes: 5 additions & 4 deletions site/src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1557,12 +1557,13 @@ export const getInsightsTemplate = async (

export interface Health {
healthy: boolean;
warning: boolean;
time: string;
coder_version: string;
access_url: { healthy: boolean };
database: { healthy: boolean };
derp: { healthy: boolean };
websocket: { healthy: boolean };
access_url: { healthy: boolean; warning: boolean };
database: { healthy: boolean; warning: boolean };
derp: { healthy: boolean; warning: boolean };
websocket: { healthy: boolean; warning: boolean };
}

export const getHealth = async () => {
Expand Down
2 changes: 1 addition & 1 deletion site/src/api/typesGenerated.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions site/src/pages/HealthPage/HealthPage.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,16 @@ export const UnhealthyDERP: Story = {
},
},
};

export const HealthyDERPWithWarning: Story = {
args: {
healthStatus: {
...MockHealth,
warning: true,
derp: {
...MockHealth.derp,
warning: true,
},
},
},
};
31 changes: 22 additions & 9 deletions site/src/pages/HealthPage/HealthPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ export function HealthPageView({
</PageHeaderTitle>
<PageHeaderSubtitle>
{healthStatus.healthy
? "All systems operational"
? healthStatus.warning
? "All systems operational, but performance might be degraded"
: "All systems operational"
: "Some issues have been detected"}
</PageHeaderSubtitle>
</div>
Expand Down Expand Up @@ -139,7 +141,8 @@ export function HealthPageView({
const isActive = tab.value === key;
const isHealthy =
healthStatus[key as keyof typeof sections].healthy;

const isWarning =
healthStatus[key as keyof typeof sections].warning;
return (
<Box
component="button"
Expand Down Expand Up @@ -171,13 +174,23 @@ export function HealthPageView({
}}
>
{isHealthy ? (
<CheckCircleOutlined
sx={{
width: 16,
height: 16,
color: (theme) => theme.palette.success.light,
}}
/>
isWarning ? (
<CheckCircleOutlined
sx={{
width: 16,
height: 16,
color: (theme) => theme.palette.warning.main,
}}
/>
) : (
<CheckCircleOutlined
sx={{
width: 16,
height: 16,
color: (theme) => theme.palette.success.light,
}}
/>
)
) : (
<ErrorOutline
sx={{
Expand Down
76 changes: 36 additions & 40 deletions site/src/testHelpers/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2385,15 +2385,18 @@ export const MockLicenseResponse: GetLicensesResponse[] = [
},
];

export const MockHealth = {
export const MockHealth: TypesGen.HealthcheckReport = {
time: "2023-08-01T16:51:03.29792825Z",
healthy: true,
failing_sections: null,
warning: false,
failing_sections: [],
derp: {
healthy: true,
warning: false,
regions: {
"999": {
healthy: true,
warning: false,
region: {
EmbeddedRelay: true,
RegionID: 999,
Expand All @@ -2419,6 +2422,7 @@ export const MockHealth = {
node_reports: [
{
healthy: true,
warning: false,
node: {
Name: "999stun0",
RegionID: 999,
Expand All @@ -2431,19 +2435,19 @@ export const MockHealth = {
TokenBucketBytesBurst: 0,
},
can_exchange_messages: false,
round_trip_ping: 0,
round_trip_ping: "0",
round_trip_ping_ms: 0,
uses_websocket: false,
client_logs: [],
client_errs: [],
error: null,
stun: {
Enabled: true,
CanSTUN: true,
Error: null,
},
},
{
healthy: true,
warning: false,
node: {
Name: "999b",
RegionID: 999,
Expand All @@ -2456,7 +2460,8 @@ export const MockHealth = {
TokenBucketBytesBurst: 0,
},
can_exchange_messages: true,
round_trip_ping: 7674330,
round_trip_ping: "7674330",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question as Cian posted for "latency". Is it backward compatibility?

round_trip_ping_ms: 7674330,
uses_websocket: false,
client_logs: [
[
Expand All @@ -2467,18 +2472,16 @@ export const MockHealth = {
],
],
client_errs: [[], []],
error: null,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does UI/CLI/something use "error" fields?

stun: {
Enabled: false,
CanSTUN: false,
Error: null,
},
},
],
error: null,
},
"10007": {
healthy: true,
warning: false,
region: {
EmbeddedRelay: false,
RegionID: 10007,
Expand All @@ -2504,6 +2507,7 @@ export const MockHealth = {
node_reports: [
{
healthy: true,
warning: false,
node: {
Name: "10007stun0",
RegionID: 10007,
Expand All @@ -2516,19 +2520,19 @@ export const MockHealth = {
TokenBucketBytesBurst: 0,
},
can_exchange_messages: false,
round_trip_ping: 0,
round_trip_ping: "0",
round_trip_ping_ms: 0,
uses_websocket: false,
client_logs: [],
client_errs: [],
error: null,
stun: {
Enabled: true,
CanSTUN: true,
Error: null,
},
},
{
healthy: true,
warning: false,
node: {
Name: "10007a",
RegionID: 10007,
Expand All @@ -2541,7 +2545,8 @@ export const MockHealth = {
TokenBucketBytesBurst: 0,
},
can_exchange_messages: true,
round_trip_ping: 170527034,
round_trip_ping: "170527034",
round_trip_ping_ms: 170527034,
uses_websocket: false,
client_logs: [
[
Expand All @@ -2552,18 +2557,16 @@ export const MockHealth = {
],
],
client_errs: [[], []],
error: null,
stun: {
Enabled: false,
CanSTUN: false,
Error: null,
},
},
],
error: null,
},
"10008": {
healthy: true,
warning: false,
region: {
EmbeddedRelay: false,
RegionID: 10008,
Expand All @@ -2589,6 +2592,7 @@ export const MockHealth = {
node_reports: [
{
healthy: true,
warning: false,
node: {
Name: "10008stun0",
RegionID: 10008,
Expand All @@ -2601,19 +2605,19 @@ export const MockHealth = {
TokenBucketBytesBurst: 0,
},
can_exchange_messages: false,
round_trip_ping: 0,
round_trip_ping: "0",
round_trip_ping_ms: 0,
uses_websocket: false,
client_logs: [],
client_errs: [],
error: null,
stun: {
Enabled: true,
CanSTUN: true,
Error: null,
},
},
{
healthy: true,
warning: false,
node: {
Name: "10008a",
RegionID: 10008,
Expand All @@ -2626,7 +2630,8 @@ export const MockHealth = {
TokenBucketBytesBurst: 0,
},
can_exchange_messages: true,
round_trip_ping: 111329690,
round_trip_ping: "111329690",
round_trip_ping_ms: 111329690,
uses_websocket: false,
client_logs: [
[
Expand All @@ -2637,18 +2642,16 @@ export const MockHealth = {
],
],
client_errs: [[], []],
error: null,
stun: {
Enabled: false,
CanSTUN: false,
Error: null,
},
},
],
error: null,
},
"10009": {
healthy: true,
warning: false,
region: {
EmbeddedRelay: false,
RegionID: 10009,
Expand All @@ -2674,6 +2677,7 @@ export const MockHealth = {
node_reports: [
{
healthy: true,
warning: false,
node: {
Name: "10009stun0",
RegionID: 10009,
Expand All @@ -2686,19 +2690,19 @@ export const MockHealth = {
TokenBucketBytesBurst: 0,
},
can_exchange_messages: false,
round_trip_ping: 0,
round_trip_ping: "0",
round_trip_ping_ms: 0,
uses_websocket: false,
client_logs: [],
client_errs: [],
error: null,
stun: {
Enabled: true,
CanSTUN: true,
Error: null,
},
},
{
healthy: true,
warning: false,
node: {
Name: "10009a",
RegionID: 10009,
Expand All @@ -2711,7 +2715,8 @@ export const MockHealth = {
TokenBucketBytesBurst: 0,
},
can_exchange_messages: true,
round_trip_ping: 138185506,
round_trip_ping: "138185506",
round_trip_ping_ms: 138185506,
uses_websocket: false,
client_logs: [
[
Expand All @@ -2722,15 +2727,12 @@ export const MockHealth = {
],
],
client_errs: [[], []],
error: null,
stun: {
Enabled: false,
CanSTUN: false,
Error: null,
},
},
],
error: null,
},
},
netcheck: {
Expand Down Expand Up @@ -2764,7 +2766,6 @@ export const MockHealth = {
GlobalV6: "",
CaptivePortal: null,
},
netcheck_err: null,
netcheck_logs: [
"netcheck: netcheck.runProbe: got STUN response for 10007stun0 from 34.71.26.24:55368 (9b07930007da49dd7df79bc7) in 1.791799ms",
"netcheck: netcheck.runProbe: got STUN response for 999stun0 from 34.71.26.24:55368 (7397fec097f1d5b01364566b) in 1.791529ms",
Expand All @@ -2777,29 +2778,24 @@ export const MockHealth = {
"netcheck: [v1] measureAllICMPLatency: listen ip4:icmp 0.0.0.0: socket: operation not permitted",
"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",
],
error: null,
},
access_url: {
access_url: "https://dev.coder.com",
healthy: true,
reachable: true,
status_code: 200,
healthz_response: "OK",
error: null,
},
websocket: {
healthy: true,
response: {
body: "",
code: 101,
},
error: null,
body: "",
code: 101,
},
database: {
healthy: true,
reachable: true,
latency: 92570,
error: null,
latency: "92570",
Copy link
Member

@johnstcn johnstcn Nov 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get rid of this field? (not in this PR)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many places in this API response are discussable. I second the question.

latency_ms: 92570,
},
coder_version: "v0.27.1-devel+c575292",
};
Expand Down