Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions search/shards.go
Original file line number Diff line number Diff line change
Expand Up @@ -932,10 +932,11 @@ func copyFiles(sr *zoekt.SearchResult) {
}
}

func logShardCrash(operation string, s zoekt.Searcher, recovered any, stack []byte) {
func logShardCrash(operation string, s zoekt.Searcher, q query.Q, recovered any, stack []byte) {
fields := []sglog.Field{
sglog.String("operation", operation),
sglog.String("shard", s.String()),
sglog.String("query", q.String()),
sglog.String("stacktrace", string(stack)),
}

Expand All @@ -953,7 +954,7 @@ func searchOneShard(ctx context.Context, s zoekt.Searcher, q query.Q, opts *zoek
defer func() {
metricSearchShardRunning.Dec()
if e := recover(); e != nil {
logShardCrash("search", s, e, debug.Stack())
logShardCrash("search", s, q, e, debug.Stack())

if sr == nil {
sr = &zoekt.SearchResult{}
Expand All @@ -975,7 +976,7 @@ func listOneShard(ctx context.Context, s zoekt.Searcher, q query.Q, opts *zoekt.
defer func() {
metricListShardRunning.Dec()
if r := recover(); r != nil {
logShardCrash("list", s, r, debug.Stack())
logShardCrash("list", s, q, r, debug.Stack())
sink <- shardListResult{
&zoekt.RepoList{Crashes: 1}, nil,
}
Expand Down
Loading