Skip to content

Commit 15cfc3f

Browse files
committed
remove health property from workspace
1 parent 16976c0 commit 15cfc3f

File tree

7 files changed

+21
-239
lines changed

7 files changed

+21
-239
lines changed

coderd/apidoc/docs.go

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

coderd/apidoc/swagger.json

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

coderd/workspaces.go

-11
Original file line numberDiff line numberDiff line change
@@ -1115,16 +1115,6 @@ func convertWorkspace(
11151115
deletingAt = calculateDeletingAt(workspace, template, workspaceBuild)
11161116
)
11171117

1118-
agentHealth := make(map[uuid.UUID]codersdk.WorkspaceAgentHealth)
1119-
for _, r := range workspaceBuild.Resources {
1120-
// For now, we only consider agent healths when the workspace is running.
1121-
if r.Transition == codersdk.WorkspaceTransitionStart {
1122-
for _, a := range r.Agents {
1123-
agentHealth[a.ID] = a.Health
1124-
}
1125-
}
1126-
}
1127-
11281118
return codersdk.Workspace{
11291119
ID: workspace.ID,
11301120
CreatedAt: workspace.CreatedAt,
@@ -1145,7 +1135,6 @@ func convertWorkspace(
11451135
LastUsedAt: workspace.LastUsedAt,
11461136
DeletingAt: deletingAt,
11471137
LockedAt: lockedAt,
1148-
Health: (codersdk.WorkspaceHealth{Agents: agentHealth}).Complete(),
11491138
}
11501139
}
11511140

codersdk/workspaces.go

-24
Original file line numberDiff line numberDiff line change
@@ -43,30 +43,6 @@ type Workspace struct {
4343
// unlocked by an admin. It is subject to deletion if it breaches
4444
// the duration of the locked_ttl field on its template.
4545
LockedAt *time.Time `json:"locked_at" format:"date-time"`
46-
// Health reports the health of the workspace and its agents.
47-
Health WorkspaceHealth `json:"health"`
48-
}
49-
50-
type WorkspaceHealth struct {
51-
Healthy bool `json:"healthy"` // Healthy is true if the workspace and all of its agents are healthy.
52-
FailingSections []string `json:"failing_sections"` // FailingSections is a list of sections that have failed their healthcheck.
53-
Agents map[uuid.UUID]WorkspaceAgentHealth `json:"agents"` // Agents is a map of agent IDs to their health.
54-
}
55-
56-
// Complete returns a new copy with the Healthy flag and FailingSections
57-
// set based on the agent healths.
58-
//
59-
//nolint:revive
60-
func (wh WorkspaceHealth) Complete() WorkspaceHealth {
61-
wh.Healthy = true
62-
wh.FailingSections = []string{}
63-
for id, agent := range wh.Agents {
64-
if !agent.Healthy {
65-
wh.Healthy = false
66-
wh.FailingSections = append(wh.FailingSections, "agents."+id.String())
67-
}
68-
}
69-
return wh
7046
}
7147

7248
type WorkspacesRequest struct {

0 commit comments

Comments
 (0)