Fetch spansets from the block for the given TraceQL FetchSpansRequest. The request is checked for internal consistencies: operand count matches the operation, all operands in each condition are identical types, and the operand type is compatible with the operation.
(ctx context.Context, req traceql.FetchSpansRequest, opts common.SearchOptions)
| 1104 | // internal consistencies: operand count matches the operation, all operands in each condition are identical |
| 1105 | // types, and the operand type is compatible with the operation. |
| 1106 | func (b *backendBlock) Fetch(ctx context.Context, req traceql.FetchSpansRequest, opts common.SearchOptions) (traceql.FetchSpansResponse, error) { |
| 1107 | err := checkConditions(req.Conditions) |
| 1108 | if err != nil { |
| 1109 | return traceql.FetchSpansResponse{}, fmt.Errorf("conditions invalid: %w", err) |
| 1110 | } |
| 1111 | |
| 1112 | coalesceConditions(&req) |
| 1113 | |
| 1114 | pf, rr, err := b.openForSearch(ctx, opts) |
| 1115 | if err != nil { |
| 1116 | return traceql.FetchSpansResponse{}, err |
| 1117 | } |
| 1118 | |
| 1119 | rgs := rowGroupsFromFile(pf, opts) |
| 1120 | |
| 1121 | iter, err := fetch(ctx, req, pf, rgs, b.meta.DedicatedColumns) |
| 1122 | if err != nil { |
| 1123 | return traceql.FetchSpansResponse{}, fmt.Errorf("creating fetch iter: %w", err) |
| 1124 | } |
| 1125 | |
| 1126 | return traceql.FetchSpansResponse{ |
| 1127 | Results: iter, |
| 1128 | Bytes: func() uint64 { return rr.BytesRead() }, |
| 1129 | }, nil |
| 1130 | } |
| 1131 | |
| 1132 | func checkConditions(conditions []traceql.Condition) error { |
| 1133 | for _, cond := range conditions { |
nothing calls this directly
no test coverage detected