fix: use correct logger for lifecycle_executor (#11763)

This commit is contained in:
Jon Ayers 2024-01-23 14:33:55 -06:00 committed by GitHub
parent e828daba6e
commit 383eed93f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 3 deletions

View File

@ -130,7 +130,11 @@ func (e *Executor) runOnce(t time.Time) Stats {
for _, ws := range workspaces { for _, ws := range workspaces {
wsID := ws.ID wsID := ws.ID
log := e.log.With(slog.F("workspace_id", wsID)) wsName := ws.Name
log := e.log.With(
slog.F("workspace_id", wsID),
slog.F("workspace_name", wsName),
)
eg.Go(func() error { eg.Go(func() error {
err := func() error { err := func() error {
@ -256,7 +260,7 @@ func (e *Executor) runOnce(t time.Time) Stats {
// If the transition didn't succeed then updating the workspace // If the transition didn't succeed then updating the workspace
// to indicate dormant didn't either. // to indicate dormant didn't either.
auditLog.Success = err == nil auditLog.Success = err == nil
auditBuild(e.ctx, e.log, *e.auditor.Load(), *auditLog) auditBuild(e.ctx, log, *e.auditor.Load(), *auditLog)
} }
if err != nil { if err != nil {
return xerrors.Errorf("transition workspace: %w", err) return xerrors.Errorf("transition workspace: %w", err)
@ -274,7 +278,7 @@ func (e *Executor) runOnce(t time.Time) Stats {
return nil return nil
}() }()
if err != nil { if err != nil {
e.log.Error(e.ctx, "failed to transition workspace", slog.Error(err)) log.Error(e.ctx, "failed to transition workspace", slog.Error(err))
statsMu.Lock() statsMu.Lock()
stats.Errors[wsID] = err stats.Errors[wsID] = err
statsMu.Unlock() statsMu.Unlock()