Skip to content

Fix search node backoff missing expires_at

Terri Chu requested to merge tchu-fix-node-backoff-missing-expires_at into master

What does this MR do and why?

Noticed while working on gitlab-com/gl-infra/production#17266 (closed)

The log statement for the node backoff has a blank expires_at so the logged message is missing info:

image

This is because the expires_at field wasn't populated until backoff! was called, but the logging is done before backoff! is called

Screenshots or screen recordings

N/A

How to set up and validate locally

you can test this in rails console directly

  1. Set up Zoekt
  2. take the zoekt webserver down: gdk stop zoekt-webserver-development
  3. note the project id that you have setup for zoekt
  4. note the zoekt node id: Search::Zoekt::Node.first
  5. in the rails console run the commands on master branch
client = Gitlab::Search::Zoekt::Client.instance
client.search('test', num: 1, project_ids: [33], node_id: 2) # run this multiple times quickly
  1. run the commands on this branch

Before

Search::Zoekt::Errors::BackoffError: Zoekt node cannot be used yet because it is in back off period until
from /Users/terrichu/projects/gitlab-development-kit/gitlab/ee/lib/gitlab/search/zoekt/client.rb:174:in `with_node_exception_handling'

After

Search::Zoekt::Errors::BackoffError: Zoekt node cannot be used yet because it is in back off period
from /Users/terrichu/projects/gitlab-development-kit/gitlab/ee/lib/gitlab/search/zoekt/client.rb:176:in `with_node_exception_handling'

new log

{"severity":"ERROR","time":"2023-12-15T16:47:47.786Z","class":"Gitlab::Search::Zoekt::Client","node_id":2,"expire_at":"2023-12-15T16:47:50.307Z","message":"Zoekt node in backoff"}

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Terri Chu

Merge request reports

Loading