mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: improve resources_monitoring for OOM & OOD monitoring (#16241)
As requested for [this issue](https://github.com/coder/internal/issues/245) we need to have a new resource `resources_monitoring` in the agent. It needs to be parsed from the provisioner and inserted into a new db table.
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
DROP TABLE IF EXISTS workspace_agent_memory_resource_monitors;
|
||||
DROP TABLE IF EXISTS workspace_agent_volume_resource_monitors;
|
||||
@@ -0,0 +1,16 @@
|
||||
CREATE TABLE workspace_agent_memory_resource_monitors (
|
||||
agent_id uuid NOT NULL REFERENCES workspace_agents(id) ON DELETE CASCADE,
|
||||
enabled boolean NOT NULL,
|
||||
threshold integer NOT NULL,
|
||||
created_at timestamp with time zone NOT NULL,
|
||||
PRIMARY KEY (agent_id)
|
||||
);
|
||||
|
||||
CREATE TABLE workspace_agent_volume_resource_monitors (
|
||||
agent_id uuid NOT NULL REFERENCES workspace_agents(id) ON DELETE CASCADE,
|
||||
enabled boolean NOT NULL,
|
||||
threshold integer NOT NULL,
|
||||
path text NOT NULL,
|
||||
created_at timestamp with time zone NOT NULL,
|
||||
PRIMARY KEY (agent_id, path)
|
||||
);
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
INSERT INTO
|
||||
workspace_agent_memory_resource_monitors (
|
||||
agent_id,
|
||||
enabled,
|
||||
threshold,
|
||||
created_at
|
||||
)
|
||||
VALUES (
|
||||
'45e89705-e09d-4850-bcec-f9a937f5d78d', -- uuid
|
||||
true,
|
||||
90,
|
||||
'2024-01-01 00:00:00'
|
||||
);
|
||||
|
||||
INSERT INTO
|
||||
workspace_agent_volume_resource_monitors (
|
||||
agent_id,
|
||||
path,
|
||||
enabled,
|
||||
threshold,
|
||||
created_at
|
||||
)
|
||||
VALUES (
|
||||
'45e89705-e09d-4850-bcec-f9a937f5d78d', -- uuid
|
||||
'/',
|
||||
true,
|
||||
90,
|
||||
'2024-01-01 00:00:00'
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user