func()

in enrichments/trace/internal/elastic/span.go [537:559]


func (s *spanEnrichmentContext) setInferredSpans(span ptrace.Span) {
	spanLinks := span.Links()
	childIDs := pcommon.NewSlice()
	spanLinks.RemoveIf(func(spanLink ptrace.SpanLink) (remove bool) {
		spanID := spanLink.SpanID()
		spanLink.Attributes().Range(func(k string, v pcommon.Value) bool {
			switch k {
			case "is_child", "elastic.is_child":
				if v.Bool() && !spanID.IsEmpty() {
					remove = true // remove the span link if it has the child attrs
					childIDs.AppendEmpty().SetStr(hex.EncodeToString(spanID[:]))
				}
				return false // stop the loop
			}
			return true
		})
		return remove
	})

	if childIDs.Len() > 0 {
		childIDs.MoveAndAppendTo(span.Attributes().PutEmptySlice(elasticattr.ChildIDs))
	}
}