Skip to content

Commit 1bcad04

Browse files
committed
WIP
1 parent 205a224 commit 1bcad04

File tree

5 files changed

+17
-1
lines changed

5 files changed

+17
-1
lines changed

coderd/healthcheck/accessurl.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
// @typescript-generate AccessURLReport
1616
type AccessURLReport struct {
1717
Healthy bool `json:"healthy"`
18+
Severity Severity `json:"severity" enums:"ok,warning,error"`
1819
Warnings []string `json:"warnings"`
1920

2021
AccessURL string `json:"access_url"`

coderd/healthcheck/database.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const (
1717
// @typescript-generate DatabaseReport
1818
type DatabaseReport struct {
1919
Healthy bool `json:"healthy"`
20+
Severity Severity `json:"severity" enums:"ok,warning,error"`
2021
Warnings []string `json:"warnings"`
2122

2223
Reachable bool `json:"reachable"`

coderd/healthcheck/derphealth/derp.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ type Report struct {
5555

5656
// @typescript-generate RegionReport
5757
type RegionReport struct {
58-
mu sync.Mutex
58+
mu sync.Mutex
59+
5960
Healthy bool `json:"healthy"`
61+
Severity Severity `json:"severity" enums:"ok,warning,error"`
6062
Warnings []string `json:"warnings"`
6163

6264
Region *tailcfg.DERPRegion `json:"region"`
@@ -70,6 +72,7 @@ type NodeReport struct {
7072
clientCounter int
7173

7274
Healthy bool `json:"healthy"`
75+
Severity Severity `json:"severity" enums:"ok,warning,error"`
7376
Warnings []string `json:"warnings"`
7477

7578
Node *tailcfg.DERPNode `json:"node"`

coderd/healthcheck/healthcheck.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ const (
1818
SectionDatabase string = "Database"
1919
)
2020

21+
const (
22+
SeverityOK Severity = "ok"
23+
SeverityWarning Severity = "warning"
24+
SeverityError Severity = "error"
25+
)
26+
27+
type Severity string
28+
2129
type Checker interface {
2230
DERP(ctx context.Context, opts *derphealth.ReportOptions) derphealth.Report
2331
AccessURL(ctx context.Context, opts *AccessURLReportOptions) AccessURLReport
@@ -31,6 +39,8 @@ type Report struct {
3139
Time time.Time `json:"time"`
3240
// Healthy is true if the report returns no errors.
3341
Healthy bool `json:"healthy"`
42+
// Severity indicates the status of Coder health.
43+
Severity Severity `json:"severity" enums:"ok,warning,error"`
3444
// FailingSections is a list of sections that have failed their healthcheck.
3545
FailingSections []string `json:"failing_sections"`
3646

coderd/healthcheck/websocket.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type WebsocketReportOptions struct {
2222
// @typescript-generate WebsocketReport
2323
type WebsocketReport struct {
2424
Healthy bool `json:"healthy"`
25+
Severity Severity `json:"severity" enums:"ok,warning,error"`
2526
Warnings []string `json:"warnings"`
2627

2728
Body string `json:"body"`

0 commit comments

Comments
 (0)