Skip to content

Commit 54e8f30

Browse files
authored
chore: remove failing_sections from healthcheck (#13426)
Closes #10854.
1 parent 5177f36 commit 54e8f30

File tree

9 files changed

+32
-74
lines changed

9 files changed

+32
-74
lines changed

coderd/apidoc/docs.go

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

coderd/apidoc/swagger.json

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

coderd/healthcheck/healthcheck.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -156,27 +156,27 @@ func Run(ctx context.Context, opts *ReportOptions) *healthsdk.HealthcheckReport
156156
wg.Wait()
157157

158158
report.Time = time.Now()
159-
report.FailingSections = []healthsdk.HealthSection{}
159+
failingSections := []healthsdk.HealthSection{}
160160
if report.DERP.Severity.Value() > health.SeverityWarning.Value() {
161-
report.FailingSections = append(report.FailingSections, healthsdk.HealthSectionDERP)
161+
failingSections = append(failingSections, healthsdk.HealthSectionDERP)
162162
}
163163
if report.AccessURL.Severity.Value() > health.SeverityOK.Value() {
164-
report.FailingSections = append(report.FailingSections, healthsdk.HealthSectionAccessURL)
164+
failingSections = append(failingSections, healthsdk.HealthSectionAccessURL)
165165
}
166166
if report.Websocket.Severity.Value() > health.SeverityWarning.Value() {
167-
report.FailingSections = append(report.FailingSections, healthsdk.HealthSectionWebsocket)
167+
failingSections = append(failingSections, healthsdk.HealthSectionWebsocket)
168168
}
169169
if report.Database.Severity.Value() > health.SeverityWarning.Value() {
170-
report.FailingSections = append(report.FailingSections, healthsdk.HealthSectionDatabase)
170+
failingSections = append(failingSections, healthsdk.HealthSectionDatabase)
171171
}
172172
if report.WorkspaceProxy.Severity.Value() > health.SeverityWarning.Value() {
173-
report.FailingSections = append(report.FailingSections, healthsdk.HealthSectionWorkspaceProxy)
173+
failingSections = append(failingSections, healthsdk.HealthSectionWorkspaceProxy)
174174
}
175175
if report.ProvisionerDaemons.Severity.Value() > health.SeverityWarning.Value() {
176-
report.FailingSections = append(report.FailingSections, healthsdk.HealthSectionProvisionerDaemons)
176+
failingSections = append(failingSections, healthsdk.HealthSectionProvisionerDaemons)
177177
}
178178

179-
report.Healthy = len(report.FailingSections) == 0
179+
report.Healthy = len(failingSections) == 0
180180

181181
// Review healthcheck sub-reports.
182182
report.Severity = health.SeverityOK

coderd/healthcheck/healthcheck_test.go

+24-44
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,10 @@ func TestHealthcheck(t *testing.T) {
4949
t.Parallel()
5050

5151
for _, c := range []struct {
52-
name string
53-
checker *testChecker
54-
healthy bool
55-
severity health.Severity
56-
failingSections []healthsdk.HealthSection
52+
name string
53+
checker *testChecker
54+
healthy bool
55+
severity health.Severity
5756
}{{
5857
name: "OK",
5958
checker: &testChecker{
@@ -93,9 +92,8 @@ func TestHealthcheck(t *testing.T) {
9392
},
9493
},
9594
},
96-
healthy: true,
97-
severity: health.SeverityOK,
98-
failingSections: []healthsdk.HealthSection{},
95+
healthy: true,
96+
severity: health.SeverityOK,
9997
}, {
10098
name: "DERPFail",
10199
checker: &testChecker{
@@ -135,9 +133,8 @@ func TestHealthcheck(t *testing.T) {
135133
},
136134
},
137135
},
138-
healthy: false,
139-
severity: health.SeverityError,
140-
failingSections: []healthsdk.HealthSection{healthsdk.HealthSectionDERP},
136+
healthy: false,
137+
severity: health.SeverityError,
141138
}, {
142139
name: "DERPWarning",
143140
checker: &testChecker{
@@ -178,9 +175,8 @@ func TestHealthcheck(t *testing.T) {
178175
},
179176
},
180177
},
181-
healthy: true,
182-
severity: health.SeverityWarning,
183-
failingSections: []healthsdk.HealthSection{},
178+
healthy: true,
179+
severity: health.SeverityWarning,
184180
}, {
185181
name: "AccessURLFail",
186182
checker: &testChecker{
@@ -220,9 +216,8 @@ func TestHealthcheck(t *testing.T) {
220216
},
221217
},
222218
},
223-
healthy: false,
224-
severity: health.SeverityWarning,
225-
failingSections: []healthsdk.HealthSection{healthsdk.HealthSectionAccessURL},
219+
healthy: false,
220+
severity: health.SeverityWarning,
226221
}, {
227222
name: "WebsocketFail",
228223
checker: &testChecker{
@@ -262,9 +257,8 @@ func TestHealthcheck(t *testing.T) {
262257
},
263258
},
264259
},
265-
healthy: false,
266-
severity: health.SeverityError,
267-
failingSections: []healthsdk.HealthSection{healthsdk.HealthSectionWebsocket},
260+
healthy: false,
261+
severity: health.SeverityError,
268262
}, {
269263
name: "DatabaseFail",
270264
checker: &testChecker{
@@ -304,9 +298,8 @@ func TestHealthcheck(t *testing.T) {
304298
},
305299
},
306300
},
307-
healthy: false,
308-
severity: health.SeverityError,
309-
failingSections: []healthsdk.HealthSection{healthsdk.HealthSectionDatabase},
301+
healthy: false,
302+
severity: health.SeverityError,
310303
}, {
311304
name: "ProxyFail",
312305
checker: &testChecker{
@@ -346,9 +339,8 @@ func TestHealthcheck(t *testing.T) {
346339
},
347340
},
348341
},
349-
severity: health.SeverityError,
350-
healthy: false,
351-
failingSections: []healthsdk.HealthSection{healthsdk.HealthSectionWorkspaceProxy},
342+
severity: health.SeverityError,
343+
healthy: false,
352344
}, {
353345
name: "ProxyWarn",
354346
checker: &testChecker{
@@ -389,9 +381,8 @@ func TestHealthcheck(t *testing.T) {
389381
},
390382
},
391383
},
392-
severity: health.SeverityWarning,
393-
healthy: true,
394-
failingSections: []healthsdk.HealthSection{},
384+
severity: health.SeverityWarning,
385+
healthy: true,
395386
}, {
396387
name: "ProvisionerDaemonsFail",
397388
checker: &testChecker{
@@ -431,9 +422,8 @@ func TestHealthcheck(t *testing.T) {
431422
},
432423
},
433424
},
434-
severity: health.SeverityError,
435-
healthy: false,
436-
failingSections: []healthsdk.HealthSection{healthsdk.HealthSectionProvisionerDaemons},
425+
severity: health.SeverityError,
426+
healthy: false,
437427
}, {
438428
name: "ProvisionerDaemonsWarn",
439429
checker: &testChecker{
@@ -474,9 +464,8 @@ func TestHealthcheck(t *testing.T) {
474464
},
475465
},
476466
},
477-
severity: health.SeverityWarning,
478-
healthy: true,
479-
failingSections: []healthsdk.HealthSection{},
467+
severity: health.SeverityWarning,
468+
healthy: true,
480469
}, {
481470
name: "AllFail",
482471
healthy: false,
@@ -518,14 +507,6 @@ func TestHealthcheck(t *testing.T) {
518507
},
519508
},
520509
severity: health.SeverityError,
521-
failingSections: []healthsdk.HealthSection{
522-
healthsdk.HealthSectionDERP,
523-
healthsdk.HealthSectionAccessURL,
524-
healthsdk.HealthSectionWebsocket,
525-
healthsdk.HealthSectionDatabase,
526-
healthsdk.HealthSectionWorkspaceProxy,
527-
healthsdk.HealthSectionProvisionerDaemons,
528-
},
529510
}} {
530511
c := c
531512
t.Run(c.name, func(t *testing.T) {
@@ -537,7 +518,6 @@ func TestHealthcheck(t *testing.T) {
537518

538519
assert.Equal(t, c.healthy, report.Healthy)
539520
assert.Equal(t, c.severity, report.Severity)
540-
assert.Equal(t, c.failingSections, report.FailingSections)
541521
assert.Equal(t, c.checker.DERPReport.Healthy, report.DERP.Healthy)
542522
assert.Equal(t, c.checker.DERPReport.Severity, report.DERP.Severity)
543523
assert.Equal(t, c.checker.DERPReport.Warnings, report.DERP.Warnings)

codersdk/healthsdk/healthsdk.go

-2
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@ type HealthcheckReport struct {
105105
Healthy bool `json:"healthy"`
106106
// Severity indicates the status of Coder health.
107107
Severity health.Severity `json:"severity" enums:"ok,warning,error"`
108-
// FailingSections is a list of sections that have failed their healthcheck.
109-
FailingSections []HealthSection `json:"failing_sections"`
110108

111109
DERP DERPHealthReport `json:"derp"`
112110
AccessURL AccessURLReport `json:"access_url"`

docs/api/debug.md

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

docs/api/schemas.md

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

site/src/api/typesGenerated.ts

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

site/src/testHelpers/entities.ts

-2
Original file line numberDiff line numberDiff line change
@@ -2528,7 +2528,6 @@ export const MockHealth: TypesGen.HealthcheckReport = {
25282528
time: "2023-08-01T16:51:03.29792825Z",
25292529
healthy: true,
25302530
severity: "ok",
2531-
failing_sections: [],
25322531
derp: {
25332532
healthy: true,
25342533
severity: "ok",
@@ -3322,7 +3321,6 @@ export const MockSharedPortsResponse: TypesGen.WorkspaceAgentPortShares = {
33223321
export const DeploymentHealthUnhealthy: TypesGen.HealthcheckReport = {
33233322
healthy: false,
33243323
severity: "ok",
3325-
failing_sections: [], // apparently this property is not used at all?
33263324
time: "2023-10-12T23:15:00.000000000Z",
33273325
coder_version: "v2.3.0-devel+8cca4915a",
33283326
access_url: {

0 commit comments

Comments
 (0)