Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit81e2b25

Browse files
authored
feat: add level support for startup logs (#7067)
This allows external services like our devcontainer support to displayerrors and warnings with custom styles to indicate failures to users.
1 parentaa2468b commit81e2b25

File tree

17 files changed

+89
-26
lines changed

17 files changed

+89
-26
lines changed

‎coderd/apidoc/docs.go‎

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/apidoc/swagger.json‎

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/dbfake/databasefake.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3706,6 +3706,7 @@ func (q *fakeQuerier) InsertWorkspaceAgentStartupLogs(_ context.Context, arg dat
37063706
ID:id,
37073707
AgentID:arg.AgentID,
37083708
CreatedAt:arg.CreatedAt[index],
3709+
Level:arg.Level[index],
37093710
Output:output,
37103711
})
37113712
outputLength+=int32(len(output))

‎coderd/database/dump.sql‎

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTERTABLE workspace_agent_startup_logs
2+
DROP COLUMN level;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTERTABLE workspace_agent_startup_logs
2+
ADD COLUMN level log_levelNOT NULL DEFAULT'info'::log_level;

‎coderd/database/models.go‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/querier_test.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ func TestInsertWorkspaceAgentStartupLogs(t *testing.T) {
111111
AgentID:agent.ID,
112112
CreatedAt: []time.Time{database.Now()},
113113
Output: []string{"first"},
114+
Level: []database.LogLevel{database.LogLevelInfo},
114115
// 1 MB is the max
115116
OutputLength:1<<20,
116117
})
@@ -121,6 +122,7 @@ func TestInsertWorkspaceAgentStartupLogs(t *testing.T) {
121122
AgentID:agent.ID,
122123
CreatedAt: []time.Time{database.Now()},
123124
Output: []string{"second"},
125+
Level: []database.LogLevel{database.LogLevelInfo},
124126
OutputLength:1,
125127
})
126128
require.True(t,database.IsStartupLogsLimitError(err))

‎coderd/database/queries.sql.go‎

Lines changed: 10 additions & 5 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/queries/workspaceagents.sql‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,12 @@ WITH new_length AS (
151151
startup_logs_length= startup_logs_length+ @output_lengthWHEREworkspace_agents.id= @agent_id
152152
)
153153
INSERT INTO
154-
workspace_agent_startup_logs
154+
workspace_agent_startup_logs (agent_id, created_at, output, level)
155155
SELECT
156156
@agent_id :: uuidAS agent_id,
157157
unnest(@created_at ::timestamptz [ ])AS created_at,
158-
unnest(@output ::VARCHAR(1024) [ ])AS output
158+
unnest(@output ::VARCHAR(1024) [ ])AS output,
159+
unnest(@level :: log_level [ ])AS level
159160
RETURNING workspace_agent_startup_logs.*;
160161

161162
-- If an agent hasn't connected in the last 7 days, we purge it's logs.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp