Skip to content

Commit

Permalink
shards: log to trace on shardedSearcher.Search
Browse files Browse the repository at this point in the history
This logging is useful since we directly call this search (and avoid
typeRepoSearcher) when evaluating List calls for type:repo searches. By
adding in this logging we can understand the performance of potentially
expensive queries here.
  • Loading branch information
keegancsmith committed Nov 25, 2024
1 parent ee3d17d commit 61a8774
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions shards/shards.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,17 @@ func doSelectRepoSet(shards []*rankedShard, and *query.And) ([]*rankedShard, que

func (ss *shardedSearcher) Search(ctx context.Context, q query.Q, opts *zoekt.SearchOptions) (sr *zoekt.SearchResult, err error) {
tr, ctx := trace.New(ctx, "shardedSearcher.Search", "")
tr.LazyLog(q, true)
tr.LazyPrintf("opts: %+v", opts)
defer func() {
if sr != nil {
tr.LazyPrintf("num files: %d", len(sr.Files))
tr.LazyPrintf("stats: %+v", sr.Stats)
}
if err != nil {
tr.LazyPrintf("error: %v", err)
tr.SetError(err)
}
tr.Finish()
}()
ctx, cancel := context.WithCancel(ctx)
Expand Down

0 comments on commit 61a8774

Please sign in to comment.