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

Method getGroupingValues

pkg/traceql/engine_metrics.go:755–778  ·  view source on GitHub ↗

getGroupingValues gets the grouping values for the span and stores them in the buffer. Returns false if the span should be dropped.

(span Span)

Source from the content-addressed store, hash-verified

753// getGroupingValues gets the grouping values for the span and stores them in the buffer.
754// Returns false if the span should be dropped.
755func (g *GroupingAggregator[F, S]) getGroupingValues(span Span) bool {
756 // Get grouping values
757 // Reuse same buffer
758 // There is no need to reset, the number of group-by attributes
759 // is fixed after creation.
760 for i, lookups := range g.byLookups {
761 val := lookup(lookups, span)
762 g.buf.vals[i] = val
763 g.buf.fast[i] = val.MapKey()
764 }
765
766 // If dynamic label exists calculate and append it
767 if g.byFunc != nil {
768 v, ok := g.byFunc(span)
769 if !ok {
770 // Totally drop this span
771 return false
772 }
773 g.buf.vals[len(g.byLookups)] = v
774 g.buf.fast[len(g.byLookups)] = v.MapKey()
775 }
776
777 return true
778}
779
780// getSeries gets the series for the current span.
781// It will reuse the last series if possible.

Callers 2

ObserveMethod · 0.95
ObserveExemplarMethod · 0.95

Calls 2

lookupFunction · 0.85
MapKeyMethod · 0.45

Tested by

no test coverage detected