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

Method Fetch

tempodb/encoding/vparquet4/block_traceql.go:1040–1064  ·  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

1038// internal consistencies: operand count matches the operation, all operands in each condition are identical
1039// types, and the operand type is compatible with the operation.
1040func (b *backendBlock) Fetch(ctx context.Context, req traceql.FetchSpansRequest, opts common.SearchOptions) (traceql.FetchSpansResponse, error) {
1041 err := checkConditions(req.Conditions)
1042 if err != nil {
1043 return traceql.FetchSpansResponse{}, fmt.Errorf("conditions invalid: %w", err)
1044 }
1045
1046 coalesceConditions(&req)
1047
1048 pf, rr, err := b.openForSearch(ctx, opts)
1049 if err != nil {
1050 return traceql.FetchSpansResponse{}, err
1051 }
1052
1053 rgs := rowGroupsFromFile(pf, opts)
1054
1055 iter, err := fetch(ctx, req, pf, rgs, b.meta.DedicatedColumns)
1056 if err != nil {
1057 return traceql.FetchSpansResponse{}, fmt.Errorf("creating fetch iter: %w", err)
1058 }
1059
1060 return traceql.FetchSpansResponse{
1061 Results: iter,
1062 Bytes: func() uint64 { return rr.BytesRead() },
1063 }, nil
1064}
1065
1066func checkConditions(conditions []traceql.Condition) error {
1067 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