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

Function newCombiner

modules/frontend/search_handlers.go:142–162  ·  view source on GitHub ↗
(req *tempopb.SearchRequest, cfg SearchSharderConfig, marshalingFormat api.MarshallingFormat, padTraceIDs bool)

Source from the content-addressed store, hash-verified

140}
141
142func 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
165func adjustLimit(limit, defaultLimit, maxLimit uint32) (uint32, error) {

Callers 2

newSearchHTTPHandlerFunction · 0.85

Calls 4

ParseNoOptimizationsFunction · 0.92
NewTypedSearchFunction · 0.92
adjustLimitFunction · 0.85
GetBoolMethod · 0.80

Tested by

no test coverage detected