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

Function makePipelineWithRowGroups

tempodb/encoding/vparquet5/block_search.go:121–275  ·  view source on GitHub ↗
(ctx context.Context, req *tempopb.SearchRequest, pf *parquet.File, rgs []parquet.RowGroup, dc backend.DedicatedColumns)

Source from the content-addressed store, hash-verified

119}
120
121func makePipelineWithRowGroups(ctx context.Context, req *tempopb.SearchRequest, pf *parquet.File, rgs []parquet.RowGroup, dc backend.DedicatedColumns) pq.Iterator {
122 makeIter := makeIterFunc(ctx, rgs, pf)
123
124 // Wire up iterators
125 var resourceIters []pq.Iterator
126 var traceIters []pq.Iterator
127
128 // Dedicated column mappings
129 spanAndResourceColumnMapping := dedicatedColumnsToColumnMapping(dc)
130
131 otherAttrConditions := map[string]string{}
132
133 for k, v := range req.Tags {
134 // dedicated attribute columns
135 if c, ok := spanAndResourceColumnMapping.get(k); ok {
136 switch c.Type {
137 case backend.DedicatedColumnTypeInt:
138 if i, err := strconv.ParseInt(v, 10, 64); err == nil {
139 // Column is integer and so is input, do integer comparison.
140 resourceIters = append(resourceIters, makeIter(c.ColumnPath, pq.NewIntEqualPredicate(i), ""))
141 } else {
142 // Column is integer but input is not, so fallback to the generic string handling.
143 otherAttrConditions[k] = v
144 continue
145 }
146 case backend.DedicatedColumnTypeString:
147 resourceIters = append(resourceIters, makeIter(c.ColumnPath, pq.NewSubstringPredicate(v), ""))
148 }
149 continue
150 }
151
152 column := labelMappings[k]
153 // if we don't have a column mapping then pass it forward to otherAttribute handling
154 if column == "" {
155 otherAttrConditions[k] = v
156 continue
157 }
158
159 // most columns are just a substring predicate over the column, but we have
160 // special handling for http status code and span status
161 if k == LabelHTTPStatusCode {
162 if i, err := strconv.ParseInt(v, 10, 64); err == nil {
163 resourceIters = append(resourceIters, makeIter(column, pq.NewIntBetweenPredicate(i, i), ""))
164 continue
165 }
166 // Non-numeric string field
167 otherAttrConditions[k] = v
168 continue
169 }
170 if k == LabelStatusCode {
171 code := StatusCodeMapping[v]
172 resourceIters = append(resourceIters, makeIter(column, pq.NewIntBetweenPredicate(int64(code), int64(code)), ""))
173 continue
174 }
175
176 if k == LabelRootServiceName || k == LabelRootSpanName {
177 traceIters = append(traceIters, makeIter(column, pq.NewSubstringPredicate(v), ""))
178 } else {

Callers 1

searchRawFunction · 0.70

Calls 4

DurationMethod · 0.80
makeIterFuncFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected