(req *tempopb.SearchRequest, cfg SearchSharderConfig, marshalingFormat api.MarshallingFormat, padTraceIDs bool)
| 140 | } |
| 141 | |
| 142 | func newCombiner(req *tempopb.SearchRequest, cfg SearchSharderConfig, marshalingFormat api.MarshallingFormat, padTraceIDs bool) (combiner.GRPCCombiner[*tempopb.SearchResponse], error) { |
| 143 | limit, err := adjustLimit(req.Limit, cfg.DefaultLimit, cfg.MaxLimit) |
| 144 | if err != nil { |
| 145 | return nil, err |
| 146 | } |
| 147 | |
| 148 | mostRecent := false |
| 149 | if len(req.Query) > 0 { |
| 150 | query, err := traceql.ParseNoOptimizations(req.Query) |
| 151 | if err != nil { |
| 152 | return nil, fmt.Errorf("invalid TraceQL query: %s", err) |
| 153 | } |
| 154 | |
| 155 | ok := false |
| 156 | if mostRecent, ok = query.Hints.GetBool(traceql.HintMostRecent, false); !ok { |
| 157 | mostRecent = false |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | return combiner.NewTypedSearch(int(limit), mostRecent, marshalingFormat, padTraceIDs), nil |
| 162 | } |
| 163 | |
| 164 | // adjusts the limit based on provided config |
| 165 | func adjustLimit(limit, defaultLimit, maxLimit uint32) (uint32, error) { |
no test coverage detected