From 78eeeb78a4f804706d32963d150493d3bf46fcd4 Mon Sep 17 00:00:00 2001 From: Albin Kerouanton Date: Fri, 3 May 2024 18:37:21 +0200 Subject: [PATCH] Add missing span.End() Previous commit made clear that `(*externalProcess).Wait()` was missing a call to `span.End()`. Signed-off-by: Albin Kerouanton --- internal/guest/runtime/hcsv2/process.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/guest/runtime/hcsv2/process.go b/internal/guest/runtime/hcsv2/process.go index de84cbc1bf..4859e3b709 100644 --- a/internal/guest/runtime/hcsv2/process.go +++ b/internal/guest/runtime/hcsv2/process.go @@ -286,7 +286,7 @@ func (ep *externalProcess) ResizeConsole(_ context.Context, height, width uint16 } func (ep *externalProcess) Wait() (<-chan int, chan<- bool) { - otelutil.StartSpan(context.Background(), "opengcs::externalProcess::Wait", trace.WithAttributes( + _, span := otelutil.StartSpan(context.Background(), "opengcs::externalProcess::Wait", trace.WithAttributes( attribute.Int64("pid", int64(ep.cmd.Process.Pid)))) exitCodeChan := make(chan int, 1) @@ -305,8 +305,10 @@ func (ep *externalProcess) Wait() (<-chan int, chan<- bool) { ep.removeOnce.Do(func() { ep.remove(ep.cmd.Process.Pid) }) + span.End() case <-doneChan: // Caller closed early, do nothing. + span.End() } }() return exitCodeChan, doneChan