Fix search node backoff missing expires_at
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:
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
- Set up Zoekt
- take the zoekt webserver down:
gdk stop zoekt-webserver-development
- note the project id that you have setup for zoekt
- note the zoekt node id:
Search::Zoekt::Node.first
- 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
- 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.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Terri Chu