fork of https://github.com/sourcegraph/zoekt
0

Configure Feed

Select the types of activity you want to include in your feed.

shards: log typeRepo sub-expression evaluation (#865)

It is hard to tell from net/trace how long we spend evaluating type:repo
sub-expressions. This adds in extra logging for when we do that, which
should help understand time taken to do this.

Test Plan: go test

+9 -4
+9 -4
shards/eval.go
··· 35 35 tr.Finish() 36 36 }() 37 37 38 - q, err = s.eval(ctx, q) 38 + q, err = s.eval(ctx, tr, q) 39 39 if err != nil { 40 40 return nil, err 41 41 } ··· 60 60 tr.Finish() 61 61 }() 62 62 63 - q, err = s.eval(ctx, q) 63 + q, err = s.eval(ctx, tr, q) 64 64 if err != nil { 65 65 return err 66 66 } ··· 92 92 tr.Finish() 93 93 }() 94 94 95 - q, err = s.eval(ctx, q) 95 + q, err = s.eval(ctx, tr, q) 96 96 if err != nil { 97 97 return nil, err 98 98 } ··· 100 100 return s.Streamer.List(ctx, q, opts) 101 101 } 102 102 103 - func (s *typeRepoSearcher) eval(ctx context.Context, q query.Q) (query.Q, error) { 103 + func (s *typeRepoSearcher) eval(ctx context.Context, tr *trace.Trace, q query.Q) (query.Q, error) { 104 104 var err error 105 105 q = query.Map(q, func(q query.Q) query.Q { 106 106 if err != nil { ··· 111 111 if !ok || rq.Type != query.TypeRepo { 112 112 return q 113 113 } 114 + 115 + tr.LazyPrintf("evaluating sub-expression %s", rq) 114 116 115 117 var rl *zoekt.RepoList 116 118 rl, err = s.Streamer.List(ctx, rq.Child, nil) ··· 122 124 for _, r := range rl.Repos { 123 125 rs.Set[r.Repository.Name] = true 124 126 } 127 + 128 + tr.LazyPrintf("replaced sub-expression with %s", rs) 129 + 125 130 return rs 126 131 }) 127 132 return q, err