diff --git a/server/traces/trace_entities.go b/server/traces/trace_entities.go index 983fb65b71..7de54e9766 100644 --- a/server/traces/trace_entities.go +++ b/server/traces/trace_entities.go @@ -194,6 +194,11 @@ func (t *Trace) Spans() []Span { return []Span{} } + if len(t.Flat) == 0 { + t.Flat = make(map[trace.SpanID]*Span) + flattenSpans(t.Flat, t.RootSpan) + } + spans := make([]Span, 0, len(t.Flat)) for _, span := range t.Flat { spans = append(spans, *span)