Skip to content

Commit 7087d9a

Browse files
committed
otel: clarify comment
Signed-off-by: David Scott <dave@recoil.org>
1 parent f70b6f4 commit 7087d9a

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

internal/vm/libkrun/instance.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,7 @@ func (v *vmInstance) Start(ctx context.Context, opts ...vm.StartOpt) (err error)
291291
return fmt.Errorf("failed to add vsock port: %w", err)
292292
}
293293

294-
// Spans use both defer (safety net for early returns) and explicit End()
295-
// on the happy path so span durations reflect the actual phase, not the
296-
// subsequent wait/sleep. OTel span End() is idempotent — second calls
297-
// are no-ops.
294+
// defer End() as a safety net for early returns.
298295
tracer := otel.Tracer("nerdbox")
299296
_, krunStartSpan := tracer.Start(ctx, "libkrun.VMStart")
300297
defer krunStartSpan.End()
@@ -372,6 +369,7 @@ func (v *vmInstance) Start(ctx context.Context, opts ...vm.StartOpt) (err error)
372369
}
373370
}
374371

372+
// Stop the spans here, don't wait for the defer. End() is idempotent.
375373
krunStartSpan.End()
376374
ttrpcWaitSpan.End()
377375

0 commit comments

Comments
 (0)