Skip to content

Commit

Permalink
avoid panic when masked parent is missing (dagger#7227)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Suraci <[email protected]>
  • Loading branch information
vito authored and vikram-dagger committed May 3, 2024
1 parent 3f33124 commit 5e47bd9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion dagql/idtui/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"sort"
"time"

"github.com/dagger/dagger/engine/slog"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
"go.opentelemetry.io/otel/trace"
)
Expand Down Expand Up @@ -49,7 +50,17 @@ func CollectSpans(db *DB, traceID trace.TraceID) []*Span {
continue
}
if span.Mask && span.Parent().IsValid() {
db.Spans[span.Parent().SpanID()].Passthrough = true
masked := db.Spans[span.Parent().SpanID()]
if masked != nil {
masked.Passthrough = true
} else {
// FIXME(vito): still investigating why this happens, but in
// the mean time, better not to panic
slog.Warn("masked parent span not found; possible data loss?",
"traceID", traceID,
"spanID", span.SpanContext().SpanID(),
"parentID", span.Parent().SpanID())
}
}
spans = append(spans, span)
}
Expand Down

0 comments on commit 5e47bd9

Please sign in to comment.