KeepGroup applies resource-level data and filtering to the spans yielded from the span-level iterators. It updates the spans in-place in the OtherEntries slice. Creation of the spanset is delayed until the traceCollector.
(res *parquetquery.IteratorResult)
| 2712 | // the span-level iterators. It updates the spans in-place in the OtherEntries slice. |
| 2713 | // Creation of the spanset is delayed until the traceCollector. |
| 2714 | func (c *batchCollector) KeepGroup(res *parquetquery.IteratorResult) bool { |
| 2715 | // First pass over spans and attributes from the AttributeCollector |
| 2716 | spans := res.OtherEntries[:0] |
| 2717 | c.resAttrs = c.resAttrs[:0] |
| 2718 | |
| 2719 | for _, kv := range res.OtherEntries { |
| 2720 | switch v := kv.Value.(type) { |
| 2721 | case *span: |
| 2722 | spans = append(spans, kv) |
| 2723 | case traceql.Static: |
| 2724 | c.resAttrs = append(c.resAttrs, attrVal{newResAttr(kv.Key), v}) |
| 2725 | } |
| 2726 | } |
| 2727 | res.OtherEntries = spans |
| 2728 | |
| 2729 | // Throw out batches without any candidate spans |
| 2730 | if len(res.OtherEntries) == 0 { |
| 2731 | return false |
| 2732 | } |
| 2733 | |
| 2734 | // Gather Attributes from dedicated resource-level columns |
| 2735 | for _, e := range res.Entries { |
| 2736 | switch e.Value.Kind() { |
| 2737 | case parquet.Int64: |
| 2738 | c.resAttrs = append(c.resAttrs, attrVal{newResAttr(e.Key), traceql.NewStaticInt(int(e.Value.Int64()))}) |
| 2739 | case parquet.ByteArray: |
| 2740 | c.resAttrs = append(c.resAttrs, attrVal{newResAttr(e.Key), traceql.NewStaticString(unsafeToString(e.Value.Bytes()))}) |
| 2741 | default: |
| 2742 | // This is a null value, indicating the attribute doesn't exist |
| 2743 | if e.Value.IsNull() { |
| 2744 | c.resAttrs = append(c.resAttrs, attrVal{newResAttr(e.Key), traceql.NewStaticString("nil")}) |
| 2745 | } |
| 2746 | } |
| 2747 | } |
| 2748 | |
| 2749 | if c.minAttributes > 0 { |
| 2750 | if len(c.resAttrs) < c.minAttributes { |
| 2751 | return false |
| 2752 | } |
| 2753 | } |
| 2754 | |
| 2755 | // Second pass. Update and further filter the spans |
| 2756 | spans = res.OtherEntries[:0] |
| 2757 | for _, e := range res.OtherEntries { |
| 2758 | span := e.Value.(*span) |
| 2759 | |
| 2760 | // Copy resource-level attributes to the span |
| 2761 | // If the span already has an entry for this attribute it |
| 2762 | // takes precedence (can be nil to indicate no match) |
| 2763 | span.setResourceAttrs(c.resAttrs) |
| 2764 | |
| 2765 | if c.requireAtLeastOneMatchOverall { |
| 2766 | // Skip over span if it didn't meet minimum criteria |
| 2767 | if span.attributesMatched() == 0 { |
| 2768 | putSpan(span) |
| 2769 | continue |
| 2770 | } |
| 2771 | } |
nothing calls this directly
no test coverage detected