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

Function create

tempodb/encoding/vparquet5/block_traceql_fetch.go:73–215  ·  view source on GitHub ↗
(makeIter, makeNilIter makeIterFn,
	// driver is iterator 0, and defines the rows for the LeftJoinIterator and Collector.  Collector.Reset()
	// is called once for each row returned by the driver. Because we want spans, this is always something at the
	// the span level, like StartTimeUnixNanos for metrics, or the virtual row number iterator for other cases.
	driver parquetquery.Iterator,
	conditions []traceql.Condition,
	secondPass traceql.SecondPassFn,
	start, end uint64,
	allConditions bool,
	selectAll bool,
	dedicatedColumns backend.DedicatedColumns,
	sampler traceql.Sampler,
)

Source from the content-addressed store, hash-verified

71}
72
73func create(makeIter, makeNilIter makeIterFn,
74 // driver is iterator 0, and defines the rows for the LeftJoinIterator and Collector. Collector.Reset()
75 // is called once for each row returned by the driver. Because we want spans, this is always something at the
76 // the span level, like StartTimeUnixNanos for metrics, or the virtual row number iterator for other cases.
77 driver parquetquery.Iterator,
78 conditions []traceql.Condition,
79 secondPass traceql.SecondPassFn,
80 start, end uint64,
81 allConditions bool,
82 selectAll bool,
83 dedicatedColumns backend.DedicatedColumns,
84 sampler traceql.Sampler,
85) (parquetquery.Iterator, *span, error) {
86 catConditions, mingledConditions, err := categorizeConditions(conditions)
87 if err != nil {
88 return nil, nil, err
89 }
90
91 // Optimization for queries like {resource.x... && span.y ...}
92 // Requires no mingled scopes like .foo=x, which could be satisfied
93 // by either resource or span.
94 allConditions = allConditions && !mingledConditions
95
96 // Don't return the final spanset upstream unless it matched at least 1 condition
97 // anywhere, except in the case of the empty query: {}
98 batchRequireAtLeastOneMatchOverall := len(conditions) > 0 && len(catConditions.trace) == 0
99
100 traceIters, traceOptional := createTraceIterators(makeIter, catConditions.trace, start, end, allConditions, dedicatedColumns, selectAll)
101
102 resIters, resOptional, err := createResourceIterators(makeIter, makeNilIter, catConditions.resource, allConditions, dedicatedColumns, selectAll)
103 if err != nil {
104 return nil, nil, err
105 }
106
107 alternateDriver, spanIters, spanOptional, err := createSpanIterators(makeIter, makeNilIter, driver == nil, catConditions.span, allConditions, selectAll, dedicatedColumns, sampler)
108 if err != nil {
109 return nil, nil, err
110 }
111
112 eventIters, eventOptional, err := createEventIterators(makeIter, makeNilIter, catConditions.event, allConditions, dedicatedColumns, selectAll)
113 if err != nil {
114 return nil, nil, err
115 }
116
117 linkIters, linkOptional, err := createLinkIterators(makeIter, makeNilIter, catConditions.link, allConditions, selectAll)
118 if err != nil {
119 return nil, nil, err
120 }
121
122 instIters, instOptional, err := createInstrumentationIterators(makeIter, makeNilIter, catConditions.instrumentation, allConditions, selectAll)
123 if err != nil {
124 return nil, nil, err
125 }
126
127 debugName := "firstPass"
128 if selectAll {
129 debugName = "secondPass"
130 }

Callers 1

fetchSpansFunction · 0.85

Calls 13

WithPoolFunction · 0.92
WithCollectorFunction · 0.92
WithNameFunction · 0.92
WithIteratorFunction · 0.92
NewLeftJoinIteratorFunction · 0.92
createTraceIteratorsFunction · 0.85
createResourceIteratorsFunction · 0.85
createSpanIteratorsFunction · 0.85
createEventIteratorsFunction · 0.85
createLinkIteratorsFunction · 0.85
newSpanCollector2Function · 0.85

Tested by

no test coverage detected