Skip to content

Record time in suggestions api

Tian Gao requested to merge 441649-Measure_AI_gateway_queue_duration into master

What does this MR do and why?

issue: #441649 (closed)

Related to &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).

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Related to #441649 (closed)

Edited by Tian Gao

Merge request reports