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

Method Results

pkg/traceql/engine_metrics_compare.go:477–519  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

475}
476
477func (b *BaselineAggregator) Results() SeriesSet {
478 output := make(SeriesSet)
479 topN := &topN[Static]{}
480
481 addSeries := func(prefix Label, name string, value Static, samples []float64, exemplars []Exemplar) {
482 ls := Labels{
483 prefix,
484 {Name: name, Value: value},
485 }
486 output[ls.MapKey()] = TimeSeries{
487 Labels: ls,
488 Values: samples,
489 Exemplars: exemplars,
490 }
491 }
492
493 do := func(buffer map[string]map[StaticMapKey]staticWithTimeSeries, prefix Label) {
494 for a, m := range buffer {
495
496 topN.reset()
497 for _, ts := range m {
498 topN.add(ts.val, ts.series.Values)
499 }
500
501 topN.get(b.topN, func(key Static) {
502 ts := m[key.MapKey()]
503 addSeries(prefix, a, key, ts.series.Values, ts.series.Exemplars)
504 })
505 }
506 }
507
508 do(b.baseline, internalLabelTypeBaseline)
509 do(b.selection, internalLabelTypeSelection)
510 do(b.baselineTotals, internalLabelTypeBaselineTotal)
511 do(b.selectionTotals, internalLabelTypeSelectionTotal)
512
513 // Add series for every attribute that exceeded max value.
514 for a := range b.maxed {
515 addSeries(internalLabelErrorTooManyValues, a, NewStaticNil(), nil, nil)
516 }
517
518 return output
519}
520
521func (b *BaselineAggregator) Length() int {
522 return len(b.baseline) + len(b.selection) + len(b.baselineTotals) + len(b.selectionTotals)

Callers

nothing calls this directly

Calls 6

MapKeyMethod · 0.95
NewStaticNilFunction · 0.85
resetMethod · 0.45
addMethod · 0.45
getMethod · 0.45
MapKeyMethod · 0.45

Tested by

no test coverage detected