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

Method Fetch

tempodb/encoding/vparquet5/block_traceql.go:1106–1130  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
1106func (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
1132func checkConditions(conditions []traceql.Condition) error {
1133 for _, cond := range conditions {

Callers

nothing calls this directly

Calls 6

openForSearchMethod · 0.95
checkConditionsFunction · 0.70
coalesceConditionsFunction · 0.70
rowGroupsFromFileFunction · 0.70
fetchFunction · 0.70
BytesReadMethod · 0.45

Tested by

no test coverage detected