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

Function NewSimpleCombiner

pkg/traceql/engine_metrics.go:1598–1626  ·  view source on GitHub ↗
(req *tempopb.QueryRangeRequest, op SimpleAggregationOp)

Source from the content-addressed store, hash-verified

1596}
1597
1598func NewSimpleCombiner(req *tempopb.QueryRangeRequest, op SimpleAggregationOp) *SimpleAggregator {
1599 var initWithNaN bool
1600 var f func(existingValue float64, newValue float64) float64
1601 switch op {
1602 case minOverTimeAggregation:
1603 // Simple min aggregator. It calculates the minimum between existing values and a new sample
1604 f = minOverTime()
1605 initWithNaN = true
1606 case maxOverTimeAggregation:
1607 // Simple max aggregator. It calculates the maximum between existing values and a new sample
1608 f = maxOverTime()
1609 initWithNaN = true
1610 case sumOverTimeAggregation:
1611 f = sumOverTime()
1612 initWithNaN = true
1613 default:
1614 // Simple addition aggregator. It adds existing values with the new sample.
1615 f = func(existingValue float64, newValue float64) float64 { return existingValue + newValue }
1616 initWithNaN = false
1617
1618 }
1619 return &SimpleAggregator{
1620 ss: make(SeriesSet),
1621 exemplarBuckets: newExemplarBucketSet(req.Exemplars, req.Start, req.End, req.Step, IsInstant(req)),
1622 intervalMapper: NewIntervalMapperFromReq(req),
1623 aggregationFunc: f,
1624 initWithNaN: initWithNaN,
1625 }
1626}
1627
1628func (b *SimpleAggregator) Combine(in []*tempopb.TimeSeries) {
1629 nan := math.Float64frombits(normalNaN)

Callers 4

initMethod · 0.85
initSumMethod · 0.85
initFinalMethod · 0.85

Calls 6

minOverTimeFunction · 0.85
maxOverTimeFunction · 0.85
sumOverTimeFunction · 0.85
newExemplarBucketSetFunction · 0.85
IsInstantFunction · 0.85
NewIntervalMapperFromReqFunction · 0.85

Tested by 1