mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 19:21:50 +00:00
searcher: warn log deadline errors in hybrid search (#58429)
Currently we are spamming sentry. This likely happens when a low search timeout is set or possibly transiently during a rollout of zoekt. Test Plan: unit tests will cover if this regresses functionality.
This commit is contained in:
parent
e45c2edb55
commit
57b839bd55
@ -53,6 +53,9 @@ func (s *Service) hybrid(ctx context.Context, rootLogger log.Logger, p *protocol
|
||||
// request. As such we centralize our observability to always take into
|
||||
// account the state of the ctx.
|
||||
defer func() {
|
||||
// We can downgrade error logs to rootLogger.Warn
|
||||
errorLogger := rootLogger.Error
|
||||
|
||||
if err != nil {
|
||||
switch ctx.Err() {
|
||||
case context.Canceled:
|
||||
@ -66,11 +69,12 @@ func (s *Service) hybrid(ctx context.Context, rootLogger log.Logger, p *protocol
|
||||
// path in this case.
|
||||
recordHybridFinalState("search-timeout")
|
||||
unsearched, ok = nil, true
|
||||
errorLogger = rootLogger.Warn
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
rootLogger.Error("hybrid search failed", log.String("state", finalState), log.Error(err))
|
||||
errorLogger("hybrid search failed", log.String("state", finalState), log.Error(err))
|
||||
} else {
|
||||
rootLogger.Debug("hybrid search done", log.String("state", finalState), log.Bool("ok", ok), log.Int("unsearched.len", len(unsearched)))
|
||||
}
|
||||
|
||||
@ -238,7 +238,8 @@ func (s *Service) search(ctx context.Context, p *protocol.Request, sender matchS
|
||||
|
||||
unsearched, ok, err := s.hybrid(ctx, logger, p, sender)
|
||||
if err != nil {
|
||||
logger.Error("hybrid search failed", log.Error(err))
|
||||
// error logging is done inside of s.hybrid so we just return
|
||||
// error here.
|
||||
return errors.Wrap(err, "hybrid search failed")
|
||||
}
|
||||
if !ok {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user