Skip to content
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
measure workspace startup closer to script finish in lines of code
  • Loading branch information
Emyrk committed Dec 13, 2023
commit eb1d173bd2a7eb394ef65f559f80eecff6a70301
3 changes: 2 additions & 1 deletion agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,8 @@ func (a *agent) run(ctx context.Context) error {
err := a.scriptRunner.Execute(ctx, func(script codersdk.WorkspaceAgentScript) bool {
return script.RunOnStart
})
// Measure the time immediately after the script has finished
dur := time.Since(start).Seconds()
if err != nil {
a.logger.Warn(ctx, "startup script(s) failed", slog.Error(err))
if errors.Is(err, agentscripts.ErrTimeout) {
Expand All @@ -766,7 +768,6 @@ func (a *agent) run(ctx context.Context) error {
a.setLifecycle(ctx, codersdk.WorkspaceAgentLifecycleReady)
}

dur := time.Since(start).Seconds()
label := "false"
if err == nil {
label = "true"
Expand Down