MCPcopy
hub / github.com/grafana/tempo / hasMissingSpans

Function hasMissingSpans

cmd/tempo-vulture/main.go:783–818  ·  view source on GitHub ↗
(t *tempopb.Trace)

Source from the content-addressed store, hash-verified

781}
782
783func 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}

Callers 2

TestHasMissingSpansFunction · 0.85
queryTraceFunction · 0.85

Calls 1

EqualMethod · 0.45

Tested by 1

TestHasMissingSpansFunction · 0.68