KeepGroup is called once per trace and creates its final spanset containing all the matching spans. These spans already contain all span-level and resource-level data.
(res *parquetquery.IteratorResult)
| 2806 | // containing all the matching spans. These spans already contain all span-level and |
| 2807 | // resource-level data. |
| 2808 | func (c *traceCollector) KeepGroup(res *parquetquery.IteratorResult) bool { |
| 2809 | finalSpanset := getSpanset() |
| 2810 | c.traceAttrs = c.traceAttrs[:0] |
| 2811 | |
| 2812 | for _, e := range res.Entries { |
| 2813 | switch e.Key { |
| 2814 | case columnPathTraceID: |
| 2815 | finalSpanset.TraceID = e.Value.ByteArray() |
| 2816 | c.traceAttrs = append(c.traceAttrs, attrVal{traceql.IntrinsicTraceIDAttribute, traceql.NewStaticString(util.TraceIDToHexString(e.Value.ByteArray()))}) |
| 2817 | case columnPathStartTimeUnixNano: |
| 2818 | finalSpanset.StartTimeUnixNanos = e.Value.Uint64() |
| 2819 | case columnPathDurationNanos: |
| 2820 | finalSpanset.DurationNanos = e.Value.Uint64() |
| 2821 | c.traceAttrs = append(c.traceAttrs, attrVal{traceql.IntrinsicTraceDurationAttribute, traceql.NewStaticDuration(time.Duration(finalSpanset.DurationNanos))}) |
| 2822 | case columnPathRootSpanName: |
| 2823 | finalSpanset.RootSpanName = unsafeToString(e.Value.Bytes()) |
| 2824 | c.traceAttrs = append(c.traceAttrs, attrVal{traceql.IntrinsicTraceRootSpanAttribute, traceql.NewStaticString(finalSpanset.RootSpanName)}) |
| 2825 | case columnPathRootServiceName: |
| 2826 | finalSpanset.RootServiceName = unsafeToString(e.Value.Bytes()) |
| 2827 | c.traceAttrs = append(c.traceAttrs, attrVal{traceql.IntrinsicTraceRootServiceAttribute, traceql.NewStaticString(finalSpanset.RootServiceName)}) |
| 2828 | } |
| 2829 | } |
| 2830 | |
| 2831 | // Pre-allocate the final number of spans |
| 2832 | numSpans := 0 |
| 2833 | for _, e := range res.OtherEntries { |
| 2834 | if _, ok := e.Value.(*span); ok { |
| 2835 | numSpans++ |
| 2836 | } |
| 2837 | } |
| 2838 | if cap(finalSpanset.Spans) < numSpans { |
| 2839 | finalSpanset.Spans = make([]traceql.Span, 0, numSpans) |
| 2840 | } |
| 2841 | for _, e := range res.OtherEntries { |
| 2842 | if span, ok := e.Value.(*span); ok { |
| 2843 | finalSpanset.Spans = append(finalSpanset.Spans, span) |
| 2844 | } |
| 2845 | } |
| 2846 | |
| 2847 | // loop over all spans and add the trace-level attributes |
| 2848 | for _, s := range finalSpanset.Spans { |
| 2849 | s := s.(*span) |
| 2850 | s.setTraceAttrs(c.traceAttrs) |
| 2851 | } |
| 2852 | |
| 2853 | res.Entries = res.Entries[:0] |
| 2854 | res.OtherEntries = res.OtherEntries[:0] |
| 2855 | res.AppendOtherValue(otherEntrySpansetKey, finalSpanset) |
| 2856 | |
| 2857 | return true |
| 2858 | } |
| 2859 | |
| 2860 | // attributeCollector receives rows from the individual key/string/int/etc |
| 2861 | // columns and joins them together into map[key]value entries with the |
nothing calls this directly
no test coverage detected