getGroupingValues gets the grouping values for the span and stores them in the buffer. Returns false if the span should be dropped.
(span Span)
| 753 | // getGroupingValues gets the grouping values for the span and stores them in the buffer. |
| 754 | // Returns false if the span should be dropped. |
| 755 | func (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. |
no test coverage detected