mirror of
https://github.com/coder/coder.git
synced 2026-10-28 02:42:54 +08:00
feat: add computed workspace and agent health fields to the api (#8280)
This commit is contained in:
@@ -1145,6 +1145,7 @@ export interface Workspace {
|
||||
readonly last_used_at: string
|
||||
readonly deleting_at?: string
|
||||
readonly locked_at?: string
|
||||
readonly health: WorkspaceHealth
|
||||
}
|
||||
|
||||
// From codersdk/workspaceagents.go
|
||||
@@ -1181,6 +1182,13 @@ export interface WorkspaceAgent {
|
||||
readonly shutdown_script?: string
|
||||
readonly shutdown_script_timeout_seconds: number
|
||||
readonly subsystem: AgentSubsystem
|
||||
readonly health: WorkspaceAgentHealth
|
||||
}
|
||||
|
||||
// From codersdk/workspaceagents.go
|
||||
export interface WorkspaceAgentHealth {
|
||||
readonly healthy: boolean
|
||||
readonly reason?: string
|
||||
}
|
||||
|
||||
// From codersdk/workspaceagentconn.go
|
||||
@@ -1300,6 +1308,12 @@ export interface WorkspaceFilter {
|
||||
readonly q?: string
|
||||
}
|
||||
|
||||
// From codersdk/workspaces.go
|
||||
export interface WorkspaceHealth {
|
||||
readonly healthy: boolean
|
||||
readonly failing_agents: string[]
|
||||
}
|
||||
|
||||
// From codersdk/workspaces.go
|
||||
export interface WorkspaceOptions {
|
||||
readonly include_deleted?: boolean
|
||||
|
||||
@@ -542,6 +542,9 @@ export const MockWorkspaceAgent: TypesGen.WorkspaceAgent = {
|
||||
startup_script_timeout_seconds: 120,
|
||||
shutdown_script_timeout_seconds: 120,
|
||||
subsystem: "envbox",
|
||||
health: {
|
||||
healthy: true,
|
||||
},
|
||||
}
|
||||
|
||||
export const MockWorkspaceAgentDisconnected: TypesGen.WorkspaceAgent = {
|
||||
@@ -552,6 +555,10 @@ export const MockWorkspaceAgentDisconnected: TypesGen.WorkspaceAgent = {
|
||||
version: "",
|
||||
latency: {},
|
||||
lifecycle_state: "ready",
|
||||
health: {
|
||||
healthy: false,
|
||||
reason: "agent is not connected",
|
||||
},
|
||||
}
|
||||
|
||||
export const MockWorkspaceAgentOutdated: TypesGen.WorkspaceAgent = {
|
||||
@@ -596,6 +603,10 @@ export const MockWorkspaceAgentTimeout: TypesGen.WorkspaceAgent = {
|
||||
version: "",
|
||||
latency: {},
|
||||
lifecycle_state: "created",
|
||||
health: {
|
||||
healthy: false,
|
||||
reason: "agent is taking too long to connect",
|
||||
},
|
||||
}
|
||||
|
||||
export const MockWorkspaceAgentStarting: TypesGen.WorkspaceAgent = {
|
||||
@@ -624,6 +635,10 @@ export const MockWorkspaceAgentStartError: TypesGen.WorkspaceAgent = {
|
||||
id: "test-workspace-agent-start-error",
|
||||
name: "a-workspace-agent-errored-while-running-startup-script",
|
||||
lifecycle_state: "start_error",
|
||||
health: {
|
||||
healthy: false,
|
||||
reason: "agent startup script failed",
|
||||
},
|
||||
}
|
||||
|
||||
export const MockWorkspaceAgentShuttingDown: TypesGen.WorkspaceAgent = {
|
||||
@@ -631,6 +646,10 @@ export const MockWorkspaceAgentShuttingDown: TypesGen.WorkspaceAgent = {
|
||||
id: "test-workspace-agent-shutting-down",
|
||||
name: "a-shutting-down-workspace-agent",
|
||||
lifecycle_state: "shutting_down",
|
||||
health: {
|
||||
healthy: false,
|
||||
reason: "agent is shutting down",
|
||||
},
|
||||
}
|
||||
|
||||
export const MockWorkspaceAgentShutdownTimeout: TypesGen.WorkspaceAgent = {
|
||||
@@ -638,6 +657,10 @@ export const MockWorkspaceAgentShutdownTimeout: TypesGen.WorkspaceAgent = {
|
||||
id: "test-workspace-agent-shutdown-timeout",
|
||||
name: "a-workspace-agent-timed-out-while-running-shutdownup-script",
|
||||
lifecycle_state: "shutdown_timeout",
|
||||
health: {
|
||||
healthy: false,
|
||||
reason: "agent is shutting down",
|
||||
},
|
||||
}
|
||||
|
||||
export const MockWorkspaceAgentShutdownError: TypesGen.WorkspaceAgent = {
|
||||
@@ -645,6 +668,10 @@ export const MockWorkspaceAgentShutdownError: TypesGen.WorkspaceAgent = {
|
||||
id: "test-workspace-agent-shutdown-error",
|
||||
name: "a-workspace-agent-errored-while-running-shutdownup-script",
|
||||
lifecycle_state: "shutdown_error",
|
||||
health: {
|
||||
healthy: false,
|
||||
reason: "agent is shutting down",
|
||||
},
|
||||
}
|
||||
|
||||
export const MockWorkspaceAgentOff: TypesGen.WorkspaceAgent = {
|
||||
@@ -652,6 +679,10 @@ export const MockWorkspaceAgentOff: TypesGen.WorkspaceAgent = {
|
||||
id: "test-workspace-agent-off",
|
||||
name: "a-workspace-agent-is-shut-down",
|
||||
lifecycle_state: "off",
|
||||
health: {
|
||||
healthy: false,
|
||||
reason: "agent is shutting down",
|
||||
},
|
||||
}
|
||||
|
||||
export const MockWorkspaceResource: TypesGen.WorkspaceResource = {
|
||||
@@ -803,6 +834,10 @@ export const MockWorkspace: TypesGen.Workspace = {
|
||||
ttl_ms: 2 * 60 * 60 * 1000,
|
||||
latest_build: MockWorkspaceBuild,
|
||||
last_used_at: "2022-05-16T15:29:10.302441433Z",
|
||||
health: {
|
||||
healthy: true,
|
||||
failing_agents: [],
|
||||
},
|
||||
}
|
||||
|
||||
export const MockStoppedWorkspace: TypesGen.Workspace = {
|
||||
|
||||
Reference in New Issue
Block a user