Skip to content

Commit 0e3bc17

Browse files
committed
The best I can do
1 parent e1978f2 commit 0e3bc17

File tree

13 files changed

+317
-105
lines changed

13 files changed

+317
-105
lines changed

coderd/apidoc/docs.go

Lines changed: 87 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 55 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/healthcheck/accessurl.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ import (
99

1010
"golang.org/x/xerrors"
1111

12-
"github.com/coder/coder/v2/coderd/healthcheck/model"
12+
"github.com/coder/coder/v2/coderd/healthcheck/health"
1313
"github.com/coder/coder/v2/coderd/util/ptr"
1414
)
1515

1616
// @typescript-generate AccessURLReport
1717
type AccessURLReport struct {
18-
model.HealthSummary
18+
Healthy bool `json:"healthy"`
19+
Severity health.Severity `json:"severity" enums:"ok,warning,error"`
20+
Warnings []string `json:"warnings"`
1921

2022
AccessURL string `json:"access_url"`
2123
Reachable bool `json:"reachable"`

coderd/healthcheck/database.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"golang.org/x/xerrors"
99

1010
"github.com/coder/coder/v2/coderd/database"
11-
"github.com/coder/coder/v2/coderd/healthcheck/model"
11+
"github.com/coder/coder/v2/coderd/healthcheck/health"
1212
)
1313

1414
const (
@@ -17,7 +17,9 @@ const (
1717

1818
// @typescript-generate DatabaseReport
1919
type DatabaseReport struct {
20-
model.HealthSummary
20+
Healthy bool `json:"healthy"`
21+
Severity health.Severity `json:"severity" enums:"ok,warning,error"`
22+
Warnings []string `json:"warnings"`
2123

2224
Reachable bool `json:"reachable"`
2325
Latency string `json:"latency"`

coderd/healthcheck/derphealth/derp.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"tailscale.com/types/key"
2222
tslogger "tailscale.com/types/logger"
2323

24-
"github.com/coder/coder/v2/coderd/healthcheck/model"
24+
"github.com/coder/coder/v2/coderd/healthcheck/health"
2525
"github.com/coder/coder/v2/coderd/util/ptr"
2626
)
2727

@@ -32,7 +32,9 @@ const (
3232

3333
// @typescript-generate Report
3434
type Report struct {
35-
model.HealthSummary
35+
Healthy bool `json:"healthy"`
36+
Severity health.Severity `json:"severity" enums:"ok,warning,error"`
37+
Warnings []string `json:"warnings"`
3638

3739
Regions map[int]*RegionReport `json:"regions"`
3840

@@ -47,7 +49,9 @@ type Report struct {
4749
type RegionReport struct {
4850
mu sync.Mutex
4951

50-
model.HealthSummary
52+
Healthy bool `json:"healthy"`
53+
Severity health.Severity `json:"severity" enums:"ok,warning,error"`
54+
Warnings []string `json:"warnings"`
5155

5256
Region *tailcfg.DERPRegion `json:"region"`
5357
NodeReports []*NodeReport `json:"node_reports"`
@@ -59,7 +63,9 @@ type NodeReport struct {
5963
mu sync.Mutex
6064
clientCounter int
6165

62-
model.HealthSummary
66+
Healthy bool `json:"healthy"`
67+
Severity health.Severity `json:"severity" enums:"ok,warning,error"`
68+
Warnings []string `json:"warnings"`
6369

6470
Node *tailcfg.DERPNode `json:"node"`
6571

@@ -153,10 +159,8 @@ func (r *RegionReport) Run(ctx context.Context) {
153159
var (
154160
node = node
155161
nodeReport = NodeReport{
156-
Node: node,
157-
HealthSummary: model.HealthSummary{
158-
Healthy: true,
159-
},
162+
Node: node,
163+
Healthy: true,
160164
}
161165
)
162166

coderd/healthcheck/health/model.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package health
2+
3+
const (
4+
SeverityOK Severity = "ok"
5+
SeverityWarning Severity = "warning"
6+
SeverityError Severity = "error"
7+
)
8+
9+
// @typescript-generate Severity
10+
type Severity string

0 commit comments

Comments
 (0)