Skip to content

Commit

Permalink
e2e tests - fixed tag search
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Elliott <[email protected]>
  • Loading branch information
joe-elliott committed Oct 25, 2024
1 parent 67a3cbb commit 19c0cab
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
17 changes: 10 additions & 7 deletions modules/frontend/search_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,17 @@ func newCombiner(req *tempopb.SearchRequest, cfg SearchSharderConfig) (combiner.
return nil, err
}

query, err := traceql.Parse(req.Query)
if err != nil {
return nil, fmt.Errorf("invalid TraceQL query: %s", err)
}
mostRecent := false
if len(req.Query) > 0 {
query, err := traceql.Parse(req.Query)
if err != nil {
return nil, fmt.Errorf("invalid TraceQL query: %s", err)
}

var mostRecent, ok bool
if mostRecent, ok = query.Hints.GetBool(traceql.HintMostRecent, false); !ok {
mostRecent = false
ok := false
if mostRecent, ok = query.Hints.GetBool(traceql.HintMostRecent, false); !ok {
mostRecent = false
}
}

return combiner.NewTypedSearch(int(limit), mostRecent), nil
Expand Down
17 changes: 10 additions & 7 deletions modules/ingester/instance_search.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,17 @@ func (i *instance) Search(ctx context.Context, req *tempopb.SearchRequest) (*tem

span.AddEvent("SearchRequest", trace.WithAttributes(attribute.String("request", req.String())))

rootExpr, err := traceql.Parse(req.Query)
if err != nil {
return nil, fmt.Errorf("error parsing query: %w", err)
}
mostRecent := false
if len(req.Query) > 0 {
rootExpr, err := traceql.Parse(req.Query)
if err != nil {
return nil, fmt.Errorf("error parsing query: %w", err)
}

var mostRecent, ok bool
if mostRecent, ok = rootExpr.Hints.GetBool(traceql.HintMostRecent, false); !ok {
mostRecent = false
ok := false
if mostRecent, ok = rootExpr.Hints.GetBool(traceql.HintMostRecent, false); !ok {
mostRecent = false
}
}

var (
Expand Down

0 comments on commit 19c0cab

Please sign in to comment.