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

Function SortTrace

tempodb/encoding/vparquet3/combiner.go:145–160  ·  view source on GitHub ↗

SortTrace sorts a parquet *Trace

(t *Trace)

Source from the content-addressed store, hash-verified

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