mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
refactor: replace startup script logs EOF with starting/ready time (#8082)
This commit reverts some of the changes in #8029 and implements an alternative method of keeping track of when the startup script has ended and there will be no more logs. This is achieved by adding new agent fields for tracking when the agent enters the "starting" and "ready"/"start_error" lifecycle states. The timestamps simplify logic since we don't need understand if the current state is before or after the state we're interested in. They can also be used to show data like how long the startup script took to execute. This also allowed us to remove the EOF field from the logs as the implementation was problematic when we returned the EOF log entry in the response since requesting _after_ that ID would give no logs and the API would thus lose track of EOF.
This commit is contained in:
committed by
GitHub
parent
b1d1b63113
commit
8dac0356ed
@ -0,0 +1,13 @@
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE workspace_agents
|
||||
DROP COLUMN started_at,
|
||||
DROP COLUMN ready_at;
|
||||
|
||||
-- We won't bring back log entries where eof = TRUE, but this doesn't matter
|
||||
-- as the implementation doesn't require it and hasn't been part of a release.
|
||||
ALTER TABLE workspace_agent_startup_logs ADD COLUMN eof boolean NOT NULL DEFAULT false;
|
||||
|
||||
COMMENT ON COLUMN workspace_agent_startup_logs.eof IS 'End of file reached';
|
||||
|
||||
COMMIT;
|
@ -0,0 +1,14 @@
|
||||
BEGIN;
|
||||
|
||||
DELETE FROM workspace_agent_startup_logs WHERE eof IS TRUE;
|
||||
|
||||
ALTER TABLE workspace_agent_startup_logs DROP COLUMN eof;
|
||||
|
||||
ALTER TABLE workspace_agents
|
||||
ADD COLUMN started_at TIMESTAMP WITH TIME ZONE DEFAULT NULL,
|
||||
ADD COLUMN ready_at TIMESTAMP WITH TIME ZONE DEFAULT NULL;
|
||||
|
||||
COMMENT ON COLUMN workspace_agents.started_at IS 'The time the agent entered the starting lifecycle state';
|
||||
COMMENT ON COLUMN workspace_agents.ready_at IS 'The time the agent entered the ready or start_error lifecycle state';
|
||||
|
||||
COMMIT;
|
Reference in New Issue
Block a user