mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
chore: rename startup logs to agent logs (#8649)
* chore: rename startup logs to agent logs This also adds a `source` property to every agent log. It should allow us to group logs and display them nicer in the UI as they stream in. * Fix migration order * Fix naming * Rename the frontend * Fix tests * Fix down migration * Match enums for workspace agent logs * Fix inserting log source * Fix migration order * Fix logs tests * Fix psql insert
This commit is contained in:
@ -621,20 +621,21 @@ func (c *Client) PostStartup(ctx context.Context, req PostStartupRequest) error
|
||||
return nil
|
||||
}
|
||||
|
||||
type StartupLog struct {
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
Output string `json:"output"`
|
||||
Level codersdk.LogLevel `json:"level"`
|
||||
type Log struct {
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
Output string `json:"output"`
|
||||
Level codersdk.LogLevel `json:"level"`
|
||||
Source codersdk.WorkspaceAgentLogSource `json:"source"`
|
||||
}
|
||||
|
||||
type PatchStartupLogs struct {
|
||||
Logs []StartupLog `json:"logs"`
|
||||
type PatchLogs struct {
|
||||
Logs []Log `json:"logs"`
|
||||
}
|
||||
|
||||
// PatchStartupLogs writes log messages to the agent startup script.
|
||||
// PatchLogs writes log messages to the agent startup script.
|
||||
// Log messages are limited to 1MB in total.
|
||||
func (c *Client) PatchStartupLogs(ctx context.Context, req PatchStartupLogs) error {
|
||||
res, err := c.SDK.Request(ctx, http.MethodPatch, "/api/v2/workspaceagents/me/startup-logs", req)
|
||||
func (c *Client) PatchLogs(ctx context.Context, req PatchLogs) error {
|
||||
res, err := c.SDK.Request(ctx, http.MethodPatch, "/api/v2/workspaceagents/me/logs", req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -737,13 +738,13 @@ func websocketNetConn(ctx context.Context, conn *websocket.Conn, msgType websock
|
||||
}
|
||||
}
|
||||
|
||||
// StartupLogsNotifyChannel returns the channel name responsible for notifying
|
||||
// of new startup logs.
|
||||
func StartupLogsNotifyChannel(agentID uuid.UUID) string {
|
||||
return fmt.Sprintf("startup-logs:%s", agentID)
|
||||
// LogsNotifyChannel returns the channel name responsible for notifying
|
||||
// of new logs.
|
||||
func LogsNotifyChannel(agentID uuid.UUID) string {
|
||||
return fmt.Sprintf("agent-logs:%s", agentID)
|
||||
}
|
||||
|
||||
type StartupLogsNotifyMessage struct {
|
||||
type LogsNotifyMessage struct {
|
||||
CreatedAfter int64 `json:"created_after"`
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user