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

Function sortTimeSeries

tempodb/tempodb_metrics_test.go:1260–1278  ·  view source on GitHub ↗
(ts []*tempopb.TimeSeries)

Source from the content-addressed store, hash-verified

1258}
1259
1260func sortTimeSeries(ts []*tempopb.TimeSeries) {
1261 sort.Slice(ts, func(i, j int) bool {
1262 if len(ts[i].Labels) != len(ts[j].Labels) {
1263 return len(ts[i].Labels) < len(ts[j].Labels)
1264 }
1265
1266 for l := range ts[i].Labels {
1267 if ts[i].Labels[l].Key != ts[j].Labels[l].Key {
1268 return ts[i].Labels[l].Key < ts[j].Labels[l].Key
1269 }
1270 if ts[i].Labels[l].Value != ts[j].Labels[l].Value {
1271 return ts[i].Labels[l].Value.String() < ts[j].Labels[l].Value.String()
1272 }
1273 }
1274
1275 // All equal
1276 return false
1277 })
1278}
1279
1280var floatComparer = cmp.Comparer(func(x, y float64) bool {
1281 return math.Abs(x-y) < 1e-6

Callers 1

TestTempoDBQueryRangeFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected