Skip to content

Commit 4e62f95

Browse files
chore(api): log lifecycle properties when creating a sandbox (#2152)
* log lifecycle properties when creating a sandbox
1 parent 47056ad commit 4e62f95

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

packages/api/internal/handlers/sandbox.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ func (a *APIStore) startSandboxInternal(
102102
startTime := time.Now()
103103
endTime := startTime.Add(timeout)
104104

105+
autoResumePolicy := "unset"
106+
if autoResume != nil {
107+
autoResumePolicy = string(autoResume.Policy)
108+
}
109+
105110
// Unique ID for the execution (from start/resume to stop/pause)
106111
executionID := uuid.New().String()
107112
sbx, instanceErr := a.orchestrator.CreateSandbox(
@@ -173,11 +178,20 @@ func (a *APIStore) startSandboxInternal(
173178
attribute.String("instance.id", sbx.SandboxID),
174179
)
175180

176-
sbxlogger.E(&sbxlogger.SandboxMetadata{
181+
logMetadata := &sbxlogger.SandboxMetadata{
177182
SandboxID: sbx.SandboxID,
178183
TemplateID: sbx.TemplateID,
179184
TeamID: team.ID.String(),
180-
}).Info(ctx, "Sandbox created", zap.String("end_time", endTime.Format("2006-01-02 15:04:05 -07:00")))
185+
}
186+
sbxlogger.E(logMetadata).Info(ctx, "Sandbox created", zap.String("end_time", endTime.Format("2006-01-02 15:04:05 -07:00")))
187+
sbxlogger.I(logMetadata).Info(
188+
ctx,
189+
"Sandbox created details",
190+
zap.String("end_time", endTime.Format("2006-01-02 15:04:05 -07:00")),
191+
zap.String("auto_resume_policy", autoResumePolicy),
192+
zap.Bool("auto_pause", autoPause),
193+
zap.String("parent_template_id", baseTemplateID),
194+
)
181195

182196
return sbx, nil
183197
}

0 commit comments

Comments
 (0)