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

Method getSeries

pkg/traceql/engine_metrics_average.go:568–596  ·  view source on GitHub ↗

getSeries gets the series for the current span. It will reuse the last series if possible.

(span Span)

Source from the content-addressed store, hash-verified

566// getSeries gets the series for the current span.
567// It will reuse the last series if possible.
568func (g *avgOverTimeSpanAggregator[F, S]) getSeries(span Span) avgOverTimeSeries[S] {
569 // Get Grouping values
570 for i, lookups := range g.byLookups {
571 val := lookup(lookups, span)
572 g.buf.vals[i] = val
573 g.buf.fast[i] = val.MapKey()
574 }
575
576 // Fast path
577 if g.lastBuf.fast == g.buf.fast && g.lastSeries.initialized {
578 return g.lastSeries
579 }
580
581 s, ok := g.series[g.buf.fast]
582 if !ok {
583 intervals := g.intervalMapper.IntervalCount()
584 s = avgOverTimeSeries[S]{
585 vals: g.buf.vals,
586 average: newAverageSeries(intervals, g.exemplars, nil),
587 exemplarBuckets: newExemplarBucketSet(g.exemplars, g.start, g.end, g.step, g.instant),
588 initialized: true,
589 }
590 g.series[g.buf.fast] = s
591 }
592
593 g.lastBuf = g.buf
594 g.lastSeries = s
595 return s
596}

Callers 2

ObserveMethod · 0.95
ObserveExemplarMethod · 0.95

Calls 5

lookupFunction · 0.85
newAverageSeriesFunction · 0.85
newExemplarBucketSetFunction · 0.85
IntervalCountMethod · 0.65
MapKeyMethod · 0.45

Tested by

no test coverage detected