8000 feat: include health severity in reports by mtojek · Pull Request #10817 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

feat: include health severity in reports #10817

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

Merged
merged 21 commits into from
Nov 23, 2023
Merged
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 21, 2023
commit 1bcad04019d0f8728b8d4400b4088ad89832500f
1 change: 1 addition & 0 deletions coderd/healthcheck/accessurl.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
// @typescript-generate AccessURLReport
type AccessURLReport struct {
Healthy bool `json:"healthy"`
Severity Severity `json:"severity" enums:"ok,warning,error"`
Warnings []string `json:"warnings"`

AccessURL string `json:"access_url"`
Expand Down
1 change: 1 addition & 0 deletions coderd/healthcheck/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const (
// @typescript-generate DatabaseReport
type DatabaseReport struct {
Healthy bool `json:"healthy"`
Severity Severity `json:"severity" enums:"ok,warning,error"`
Warnings []string `json:"warnings"`

Reachable bool `json:"reachable"`
Expand Down
5 changes: 4 additions & 1 deletion coderd/healthcheck/derphealth/derp.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ type Report struct {

// @typescript-generate RegionReport
type RegionReport struct {
mu sync.Mutex
mu sync.Mutex

Healthy bool `json:"healthy"`
Severity Severity `json:"severity" enums:"ok,warning,error"`
Warnings []string `json:"warnings"`

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

Healthy bool `json:"healthy"`
Severity Severity `json:"severity" enums:"ok,warning,error"`
Warnings []string `json:"warnings"`

Node *tailcfg.DERPNode `json:"node"`
Expand Down
10 changes: 10 additions & 0 deletions coderd/healthcheck/healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ const (
SectionDatabase string = "Database"
)

const (
SeverityOK Severity = "ok"
SeverityWarning Severity = "warning"
SeverityError Severity = "error"
)

type Severity string

type Checker interface {
DERP(ctx context.Context, opts *derphealth.ReportOptions) derphealth.Report
AccessURL(ctx context.Context, opts *AccessURLReportOptions) AccessURLReport
Expand All @@ -31,6 +39,8 @@ type Report struct {
Time time.Time `json:"time"`
// Healthy is true if the report returns no errors.
Healthy bool `json:"healthy"`
// Severity indicates the status of Coder health.
Severity Severity `json:"severity" enums:"ok,warning,error"`
// FailingSections is a list of sections that have failed their healthcheck.
FailingSections []string `json:"failing_sections"`

Expand Down
1 change: 1 addition & 0 deletions coderd/healthcheck/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type WebsocketReportOptions struct {
// @typescript-generate WebsocketReport
type WebsocketReport struct {
Healthy bool `json:"healthy"`
Severity Severity `json:"severity" enums:"ok,warning,error"`
Warnings []string `json:"warnings"`

Body string `json:"body"`
Expand Down
0