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

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
kylecarbs merged 34 commits intomainfromstartuplogs
Mar 23, 2023
Merged
Show file tree
Hide file tree
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-asherFeb 23, 2023
66c8ec3
Add coderd endpoints for startup script logs
code-asherFeb 23, 2023
1cc3e9d
Push startup script logs from agent
code-asherFeb 23, 2023
45d250f
Pull startup script logs on frontend
code-asherFeb 23, 2023
7fed360
Merge branch 'main' into startuplogs
kylecarbsMar 10, 2023
7ce73aa
Rename queries
kylecarbsMar 10, 2023
b86c400
Add constraint
kylecarbsMar 11, 2023
0c4d2c3
Start creating log sending loop
kylecarbsMar 13, 2023
1bb700f
Add log sending to the agent
kylecarbsMar 13, 2023
736705f
Add tests for streaming logs
kylecarbsMar 13, 2023
f741523
Shorten notify channel name
kylecarbsMar 14, 2023
54c30be
Add FE
kylecarbsMar 14, 2023
adb06ea
Improve bulk log performance
kylecarbsMar 15, 2023
4061b13
Finish UI display
kylecarbsMar 15, 2023
4c5b630
Fix startup log visibility
kylecarbsMar 15, 2023
05d536c
Add warning for overflow
kylecarbsMar 16, 2023
34fde1a
Fix agent queue logs overflow
kylecarbsMar 17, 2023
379f1f4
Display staartup logs in a virtual DOM for performance
kylecarbsMar 19, 2023
decde5c
Fix agent queue with loads of logs
kylecarbsMar 20, 2023
d74457c
Merge branch 'main' into startuplogs
kylecarbsMar 20, 2023
ac55f48
Fix authorize test
kylecarbsMar 20, 2023
8d75963
Remove faulty test
kylecarbsMar 20, 2023
cc715cd
Fix startup and shutdown reporting error
kylecarbsMar 20, 2023
e3a4b2c
Fix gen
kylecarbsMar 20, 2023
399dad7
Merge branch 'main' into startuplogs
kylecarbsMar 22, 2023
45c0aca
Fix comments
kylecarbsMar 22, 2023
5a0b15d
Periodically purge old database entries
kylecarbsMar 23, 2023
b1b3fcb
Add test fixture for migration
kylecarbsMar 23, 2023
6e1032c
Add Storybook
kylecarbsMar 23, 2023
3762e8d
Check if there are logs when displaying features
kylecarbsMar 23, 2023
f6b9fce
Fix startup component overflow gap
kylecarbsMar 23, 2023
c48658c
Fix startup log wrapping
kylecarbsMar 23, 2023
4ec1a0e
Merge branch 'main' into startuplogs
kylecarbsMar 23, 2023
b55b7a1
Merge branch 'main' into startuplogs
kylecarbsMar 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Fix agent queue with loads of logs
  • Loading branch information
@kylecarbs
kylecarbs committedMar 20, 2023
commitdecde5c9898b3443c7c84c89748084413310c6d6
12 changes: 11 additions & 1 deletionagent/agent.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -666,6 +666,13 @@ func (a *agent) runScript(ctx context.Context, lifecycle, script string) error {
var flushLogsTimer *time.Timer
var logMutex sync.Mutex
var logsSending bool
defer func() {
logMutex.Lock()
if flushLogsTimer != nil {
flushLogsTimer.Stop()
}
logMutex.Unlock()
}()

// sendLogs function uploads the queued logs to the server
sendLogs := func() {
Expand DownExpand Up@@ -708,6 +715,7 @@ func (a *agent) runScript(ctx context.Context, lifecycle, script string) error {
// Reset logsSending flag
logMutex.Lock()
logsSending = false
flushLogsTimer.Reset(100 * time.Millisecond)
logMutex.Unlock()
}
// queueLog function appends a log to the queue and triggers sendLogs if necessary
Expand All@@ -720,8 +728,10 @@ func (a *agent) runScript(ctx context.Context, lifecycle, script string) error {

// If there are more than 100 logs, send them immediately
if len(queuedLogs) > 100 {
// Don't early return after this, because we still want
// to reset the timer just in case logs come in while
// we're sending.
go sendLogs()
return
}
// Reset or set the flushLogsTimer to trigger sendLogs after 100 milliseconds
if flushLogsTimer != nil {
Expand Down
5 changes: 4 additions & 1 deletioncli/agent.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -117,7 +117,10 @@ func workspaceAgent() *cobra.Command {
client := agentsdk.New(coderURL)
client.SDK.Logger = logger
// Set a reasonable timeout so requests can't hang forever!
client.SDK.HTTPClient.Timeout = 10 * time.Second
// The timeout needs to be reasonably long, because requests
// with large payloads can take a bit. e.g. startup scripts
// may take a while to insert.
client.SDK.HTTPClient.Timeout = 30 * time.Second

// Enable pprof handler
// This prevents the pprof import from being accidentally deleted.
Expand Down
6 changes: 6 additions & 0 deletionssite/src/components/Resources/AgentRow.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -97,11 +97,17 @@ export const AgentRow: FC<AgentRowProps> = ({
return logs
}, [logsMachine.context.startupLogs, agent.startup_logs_overflowed])
const [bottomOfLogs, setBottomOfLogs] = useState(true)
// This is a layout effect to remove flicker when we're scrolling to the bottom.
useLayoutEffect(() => {
// If we're currently watching the bottom, we always want to stay at the bottom.
if (bottomOfLogs && logListRef.current) {
logListRef.current.scrollToItem(startupLogs.length - 1, "end")
}
}, [showStartupLogs, startupLogs, logListRef, bottomOfLogs])

// This is a bit of a hack on the react-window API to get the scroll position.
// If we're scrolled to the bottom, we want to keep the list scrolled to the bottom.
// This makes it feel similar to a terminal that auto-scrolls downwards!
const handleLogScroll = useCallback(
(props: ListOnScrollProps) => {
if (
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp