Record time in suggestions api
What does this merge request do and why?
issue: gitlab-org/gitlab#441649 (closed)
Related to gitlab-org&12224 (comment 1770963792)
Currently there is no metric to measure time spent by code completions request between Rails and AI gateway (latency added by sending request from Rails to AI gateway). We could use same approach as with rails queue duration: add timestamp to request headers and then calculate difference on AI gateway side similar to https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/middleware/rails_queue_duration.rb#L16
This assumes that time is accurate both on Rails and AI gateway server (in case of self-managed servers this may not be true).
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
Merge request checklist
-
Tests added for new functionality. If not, please raise an issue to follow up. -
Documentation added/updated, if needed.
Edited by Tian Gao