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

Function SortTrace

tempodb/encoding/vparquet4/combiner.go:147–162  ·  view source on GitHub ↗

SortTrace sorts a parquet *Trace

(t *Trace)

Source from the content-addressed store, hash-verified

145
146// SortTrace sorts a parquet *Trace
147func SortTrace(t *Trace) {
148 // Sort bottom up by span start times
149 for _, b := range t.ResourceSpans {
150 for _, ils := range b.ScopeSpans {
151 sort.Slice(ils.Spans, func(i, j int) bool {
152 return compareSpans(&ils.Spans[i], &ils.Spans[j])
153 })
154 }
155 sort.Slice(b.ScopeSpans, func(i, j int) bool {
156 return compareScopeSpans(&b.ScopeSpans[i], &b.ScopeSpans[j])
157 })
158 }
159 sort.Slice(t.ResourceSpans, func(i, j int) bool {
160 return compareBatches(&t.ResourceSpans[i], &t.ResourceSpans[j])
161 })
162}
163
164func compareBatches(a, b *ResourceSpans) bool {
165 if len(a.ScopeSpans) > 0 && len(b.ScopeSpans) > 0 {

Callers 2

BenchmarkSortTraceFunction · 0.70
ResultMethod · 0.70

Calls 3

compareSpansFunction · 0.70
compareScopeSpansFunction · 0.70
compareBatchesFunction · 0.70

Tested by 1

BenchmarkSortTraceFunction · 0.56