Skip to content

Commit

Permalink
fix: make sure trace.Spans() consider tree object when flat is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
mathnogueira committed Sep 6, 2023
1 parent 3cce590 commit 74f2b36
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server/traces/trace_entities.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 74f2b36

Please sign in to comment.