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

Function SortTrace

tempodb/encoding/vparquet5/combiner.go:148–163  ·  view source on GitHub ↗

SortTrace sorts a parquet *Trace

(t *Trace)

Source from the content-addressed store, hash-verified

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