chore: remove failing_sections from healthcheck (#13426)

Closes #10854.
This commit is contained in:
Kyle Carberry
2024-06-21 14:49:02 -04:00
committed by GitHub
parent 5177f366f5
commit 54e8f30002
9 changed files with 32 additions and 74 deletions
-7
View File
@@ -13767,13 +13767,6 @@ const docTemplate = `{
"derp": {
"$ref": "#/definitions/healthsdk.DERPHealthReport"
},
"failing_sections": {
"description": "FailingSections is a list of sections that have failed their healthcheck.",
"type": "array",
"items": {
"$ref": "#/definitions/healthsdk.HealthSection"
}
},
"healthy": {
"description": "Healthy is true if the report returns no errors.\nDeprecated: use ` + "`" + `Severity` + "`" + ` instead",
"type": "boolean"
-7
View File
@@ -12530,13 +12530,6 @@
"derp": {
"$ref": "#/definitions/healthsdk.DERPHealthReport"
},
"failing_sections": {
"description": "FailingSections is a list of sections that have failed their healthcheck.",
"type": "array",
"items": {
"$ref": "#/definitions/healthsdk.HealthSection"
}
},
"healthy": {
"description": "Healthy is true if the report returns no errors.\nDeprecated: use `Severity` instead",
"type": "boolean"
+8 -8
View File
@@ -156,27 +156,27 @@ func Run(ctx context.Context, opts *ReportOptions) *healthsdk.HealthcheckReport
wg.Wait()
report.Time = time.Now()
report.FailingSections = []healthsdk.HealthSection{}
failingSections := []healthsdk.HealthSection{}
if report.DERP.Severity.Value() > health.SeverityWarning.Value() {
report.FailingSections = append(report.FailingSections, healthsdk.HealthSectionDERP)
failingSections = append(failingSections, healthsdk.HealthSectionDERP)
}
if report.AccessURL.Severity.Value() > health.SeverityOK.Value() {
report.FailingSections = append(report.FailingSections, healthsdk.HealthSectionAccessURL)
failingSections = append(failingSections, healthsdk.HealthSectionAccessURL)
}
if report.Websocket.Severity.Value() > health.SeverityWarning.Value() {
report.FailingSections = append(report.FailingSections, healthsdk.HealthSectionWebsocket)
failingSections = append(failingSections, healthsdk.HealthSectionWebsocket)
}
if report.Database.Severity.Value() > health.SeverityWarning.Value() {
report.FailingSections = append(report.FailingSections, healthsdk.HealthSectionDatabase)
failingSections = append(failingSections, healthsdk.HealthSectionDatabase)
}
if report.WorkspaceProxy.Severity.Value() > health.SeverityWarning.Value() {
report.FailingSections = append(report.FailingSections, healthsdk.HealthSectionWorkspaceProxy)
failingSections = append(failingSections, healthsdk.HealthSectionWorkspaceProxy)
}
if report.ProvisionerDaemons.Severity.Value() > health.SeverityWarning.Value() {
report.FailingSections = append(report.FailingSections, healthsdk.HealthSectionProvisionerDaemons)
failingSections = append(failingSections, healthsdk.HealthSectionProvisionerDaemons)
}
report.Healthy = len(report.FailingSections) == 0
report.Healthy = len(failingSections) == 0
// Review healthcheck sub-reports.
report.Severity = health.SeverityOK
+24 -44
View File
@@ -49,11 +49,10 @@ func TestHealthcheck(t *testing.T) {
t.Parallel()
for _, c := range []struct {
name string
checker *testChecker
healthy bool
severity health.Severity
failingSections []healthsdk.HealthSection
name string
checker *testChecker
healthy bool
severity health.Severity
}{{
name: "OK",
checker: &testChecker{
@@ -93,9 +92,8 @@ func TestHealthcheck(t *testing.T) {
},
},
},
healthy: true,
severity: health.SeverityOK,
failingSections: []healthsdk.HealthSection{},
healthy: true,
severity: health.SeverityOK,
}, {
name: "DERPFail",
checker: &testChecker{
@@ -135,9 +133,8 @@ func TestHealthcheck(t *testing.T) {
},
},
},
healthy: false,
severity: health.SeverityError,
failingSections: []healthsdk.HealthSection{healthsdk.HealthSectionDERP},
healthy: false,
severity: health.SeverityError,
}, {
name: "DERPWarning",
checker: &testChecker{
@@ -178,9 +175,8 @@ func TestHealthcheck(t *testing.T) {
},
},
},
healthy: true,
severity: health.SeverityWarning,
failingSections: []healthsdk.HealthSection{},
healthy: true,
severity: health.SeverityWarning,
}, {
name: "AccessURLFail",
checker: &testChecker{
@@ -220,9 +216,8 @@ func TestHealthcheck(t *testing.T) {
},
},
},
healthy: false,
severity: health.SeverityWarning,
failingSections: []healthsdk.HealthSection{healthsdk.HealthSectionAccessURL},
healthy: false,
severity: health.SeverityWarning,
}, {
name: "WebsocketFail",
checker: &testChecker{
@@ -262,9 +257,8 @@ func TestHealthcheck(t *testing.T) {
},
},
},
healthy: false,
severity: health.SeverityError,
failingSections: []healthsdk.HealthSection{healthsdk.HealthSectionWebsocket},
healthy: false,
severity: health.SeverityError,
}, {
name: "DatabaseFail",
checker: &testChecker{
@@ -304,9 +298,8 @@ func TestHealthcheck(t *testing.T) {
},
},
},
healthy: false,
severity: health.SeverityError,
failingSections: []healthsdk.HealthSection{healthsdk.HealthSectionDatabase},
healthy: false,
severity: health.SeverityError,
}, {
name: "ProxyFail",
checker: &testChecker{
@@ -346,9 +339,8 @@ func TestHealthcheck(t *testing.T) {
},
},
},
severity: health.SeverityError,
healthy: false,
failingSections: []healthsdk.HealthSection{healthsdk.HealthSectionWorkspaceProxy},
severity: health.SeverityError,
healthy: false,
}, {
name: "ProxyWarn",
checker: &testChecker{
@@ -389,9 +381,8 @@ func TestHealthcheck(t *testing.T) {
},
},
},
severity: health.SeverityWarning,
healthy: true,
failingSections: []healthsdk.HealthSection{},
severity: health.SeverityWarning,
healthy: true,
}, {
name: "ProvisionerDaemonsFail",
checker: &testChecker{
@@ -431,9 +422,8 @@ func TestHealthcheck(t *testing.T) {
},
},
},
severity: health.SeverityError,
healthy: false,
failingSections: []healthsdk.HealthSection{healthsdk.HealthSectionProvisionerDaemons},
severity: health.SeverityError,
healthy: false,
}, {
name: "ProvisionerDaemonsWarn",
checker: &testChecker{
@@ -474,9 +464,8 @@ func TestHealthcheck(t *testing.T) {
},
},
},
severity: health.SeverityWarning,
healthy: true,
failingSections: []healthsdk.HealthSection{},
severity: health.SeverityWarning,
healthy: true,
}, {
name: "AllFail",
healthy: false,
@@ -518,14 +507,6 @@ func TestHealthcheck(t *testing.T) {
},
},
severity: health.SeverityError,
failingSections: []healthsdk.HealthSection{
healthsdk.HealthSectionDERP,
healthsdk.HealthSectionAccessURL,
healthsdk.HealthSectionWebsocket,
healthsdk.HealthSectionDatabase,
healthsdk.HealthSectionWorkspaceProxy,
healthsdk.HealthSectionProvisionerDaemons,
},
}} {
c := c
t.Run(c.name, func(t *testing.T) {
@@ -537,7 +518,6 @@ func TestHealthcheck(t *testing.T) {
assert.Equal(t, c.healthy, report.Healthy)
assert.Equal(t, c.severity, report.Severity)
assert.Equal(t, c.failingSections, report.FailingSections)
assert.Equal(t, c.checker.DERPReport.Healthy, report.DERP.Healthy)
assert.Equal(t, c.checker.DERPReport.Severity, report.DERP.Severity)
assert.Equal(t, c.checker.DERPReport.Warnings, report.DERP.Warnings)
-2
View File
@@ -105,8 +105,6 @@ type HealthcheckReport struct {
Healthy bool `json:"healthy"`
// Severity indicates the status of Coder health.
Severity health.Severity `json:"severity" enums:"ok,warning,error"`
// FailingSections is a list of sections that have failed their healthcheck.
FailingSections []HealthSection `json:"failing_sections"`
DERP DERPHealthReport `json:"derp"`
AccessURL AccessURLReport `json:"access_url"`
-1
View File
@@ -280,7 +280,6 @@ curl -X GET http://coder-server:8080/api/v2/debug/health \
}
]
},
"failing_sections": ["DERP"],
"healthy": true,
"provisioner_daemons": {
"dismissed": true,
-2
View File
@@ -7946,7 +7946,6 @@ If the schedule is empty, the user will be updated to use the default schedule.|
}
]
},
"failing_sections": ["DERP"],
"healthy": true,
"provisioner_daemons": {
"dismissed": true,
@@ -8048,7 +8047,6 @@ If the schedule is empty, the user will be updated to use the default schedule.|
| `coder_version` | string | false | | The Coder version of the server that the report was generated on. |
| `database` | [healthsdk.DatabaseReport](#healthsdkdatabasereport) | false | | |
| `derp` | [healthsdk.DERPHealthReport](#healthsdkderphealthreport) | false | | |
| `failing_sections` | array of [healthsdk.HealthSection](#healthsdkhealthsection) | false | | Failing sections is a list of sections that have failed their healthcheck. |
| `healthy` | boolean | false | | Healthy is true if the report returns no errors. Deprecated: use `Severity` instead |
| `provisioner_daemons` | [healthsdk.ProvisionerDaemonsReport](#healthsdkprovisionerdaemonsreport) | false | | |
| `severity` | [health.Severity](#healthseverity) | false | | Severity indicates the status of Coder health. |
-1
View File
@@ -2472,7 +2472,6 @@ export interface HealthcheckReport {
readonly time: string;
readonly healthy: boolean;
readonly severity: HealthSeverity;
readonly failing_sections: readonly HealthSection[];
readonly derp: DERPHealthReport;
readonly access_url: AccessURLReport;
readonly websocket: WebsocketReport;
-2
View File
@@ -2528,7 +2528,6 @@ export const MockHealth: TypesGen.HealthcheckReport = {
time: "2023-08-01T16:51:03.29792825Z",
healthy: true,
severity: "ok",
failing_sections: [],
derp: {
healthy: true,
severity: "ok",
@@ -3322,7 +3321,6 @@ export const MockSharedPortsResponse: TypesGen.WorkspaceAgentPortShares = {
export const DeploymentHealthUnhealthy: TypesGen.HealthcheckReport = {
healthy: false,
severity: "ok",
failing_sections: [], // apparently this property is not used at all?
time: "2023-10-12T23:15:00.000000000Z",
coder_version: "v2.3.0-devel+8cca4915a",
access_url: {