- Notifications
You must be signed in to change notification settings - Fork929
feat: add startup script logs to the ui#6558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes from1 commit
Commits
Show all changes
34 commits Select commitHold shift + click to select a range
99d510c
Add startup script logs to the database
code-asher66c8ec3
Add coderd endpoints for startup script logs
code-asher1cc3e9d
Push startup script logs from agent
code-asher45d250f
Pull startup script logs on frontend
code-asher7fed360
Merge branch 'main' into startuplogs
kylecarbs7ce73aa
Rename queries
kylecarbsb86c400
Add constraint
kylecarbs0c4d2c3
Start creating log sending loop
kylecarbs1bb700f
Add log sending to the agent
kylecarbs736705f
Add tests for streaming logs
kylecarbsf741523
Shorten notify channel name
kylecarbs54c30be
Add FE
kylecarbsadb06ea
Improve bulk log performance
kylecarbs4061b13
Finish UI display
kylecarbs4c5b630
Fix startup log visibility
kylecarbs05d536c
Add warning for overflow
kylecarbs34fde1a
Fix agent queue logs overflow
kylecarbs379f1f4
Display staartup logs in a virtual DOM for performance
kylecarbsdecde5c
Fix agent queue with loads of logs
kylecarbsd74457c
Merge branch 'main' into startuplogs
kylecarbsac55f48
Fix authorize test
kylecarbs8d75963
Remove faulty test
kylecarbscc715cd
Fix startup and shutdown reporting error
kylecarbse3a4b2c
Fix gen
kylecarbs399dad7
Merge branch 'main' into startuplogs
kylecarbs45c0aca
Fix comments
kylecarbs5a0b15d
Periodically purge old database entries
kylecarbsb1b3fcb
Add test fixture for migration
kylecarbs6e1032c
Add Storybook
kylecarbs3762e8d
Check if there are logs when displaying features
kylecarbsf6b9fce
Fix startup component overflow gap
kylecarbsc48658c
Fix startup log wrapping
kylecarbs4ec1a0e
Merge branch 'main' into startuplogs
kylecarbsb55b7a1
Merge branch 'main' into startuplogs
kylecarbsFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
Add tests for streaming logs
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commit736705f87068ded10740972bfdaeefb31e46f24c
There are no files selected for viewing
32 changes: 7 additions & 25 deletionsagent/agent.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -88,7 +88,7 @@ type Client interface { | ||
PostLifecycle(ctx context.Context, state agentsdk.PostLifecycleRequest) error | ||
PostAppHealth(ctx context.Context, req agentsdk.PostAppHealthsRequest) error | ||
PostStartup(ctx context.Context, req agentsdk.PostStartupRequest) error | ||
PatchStartupLogs(ctx context.Context, req agentsdk.PatchStartupLogs) error | ||
} | ||
func New(options Options) io.Closer { | ||
@@ -202,19 +202,6 @@ func (a *agent) runLoop(ctx context.Context) { | ||
} | ||
} | ||
// reportLifecycleLoop reports the current lifecycle state once. | ||
// Only the latest state is reported, intermediate states may be | ||
// lost if the agent can't communicate with the API. | ||
@@ -680,25 +667,20 @@ func (a *agent) runScript(ctx context.Context, lifecycle, script string) error { | ||
return | ||
} | ||
logsSending = true | ||
logsToSend := queuedLogs | ||
queuedLogs = make([]agentsdk.StartupLog, 0) | ||
logMutex.Unlock() | ||
for r := retry.New(time.Second, 5*time.Second); r.Wait(ctx); { | ||
err := a.client.PatchStartupLogs(ctx, agentsdk.PatchStartupLogs{ | ||
Logs: logsToSend, | ||
}) | ||
kylecarbs marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
if err == nil { | ||
break | ||
} | ||
a.logger.Error(ctx, "upload startup logs", slog.Error(err), slog.F("to_send", logsToSend)) | ||
} | ||
logMutex.Lock() | ||
logsSending = false | ||
logMutex.Unlock() | ||
} | ||
queueLog := func(log agentsdk.StartupLog) { | ||
4 changes: 2 additions & 2 deletionsagent/agent_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
32 changes: 0 additions & 32 deletionscoderd/provisionerjobs_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -89,36 +89,4 @@ func TestProvisionerJobLogs(t *testing.T) { | ||
} | ||
} | ||
}) | ||
} |
8 changes: 4 additions & 4 deletionscoderd/workspaceagents.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletionscoderd/workspaceagents_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletioncoderd/wsconncache/wsconncache_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
8 changes: 6 additions & 2 deletionscodersdk/agentsdk/agentsdk.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
23 changes: 0 additions & 23 deletionscodersdk/provisionerdaemons.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletionscodersdk/templateversions.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletionscodersdk/workspaceagents.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.