| 781 | } |
| 782 | |
| 783 | func hasMissingSpans(t *tempopb.Trace) bool { |
| 784 | // check that all parent spans exist in the trace |
| 785 | parentSpanIDs := make([][]byte, 0) |
| 786 | |
| 787 | for _, b := range t.ResourceSpans { |
| 788 | for _, ss := range b.ScopeSpans { |
| 789 | for _, s := range ss.Spans { |
| 790 | if len(s.ParentSpanId) > 0 { |
| 791 | parentSpanIDs = append(parentSpanIDs, s.ParentSpanId) |
| 792 | } |
| 793 | } |
| 794 | } |
| 795 | } |
| 796 | |
| 797 | for _, id := range parentSpanIDs { |
| 798 | found := false |
| 799 | |
| 800 | B: |
| 801 | for _, b := range t.ResourceSpans { |
| 802 | for _, ss := range b.ScopeSpans { |
| 803 | for _, s := range ss.Spans { |
| 804 | if bytes.Equal(s.SpanId, id) { |
| 805 | found = true |
| 806 | break B |
| 807 | } |
| 808 | } |
| 809 | } |
| 810 | } |
| 811 | |
| 812 | if !found { |
| 813 | return true |
| 814 | } |
| 815 | } |
| 816 | |
| 817 | return false |
| 818 | } |