Skip to content

Add more extensive logging guarded by feature flag

Gosia Ksionek requested to merge mk-add-logs into master

What does this MR do and why?

Add logging every log of LLM cycle. It is guarded by the feature flag scoped to user.

Some explanation: I was thinking of overriding debug method in Llm::Logger class and adding the condition there. I decided against it as it would made the logic a bit hidden and making it less readable.

In the course of the review, I created info_or_debug method that encapsulates the feature flag logic.

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.

  1. In rails console enable the experiment fully
    Feature.enable(:expanded_ai_loggging)
  2. Ask some question in chat.
  3. check if entries in llm.log are logged on info level.
  4. Switch feature flag off, ask question again and compare llm.log file content.

MR acceptance checklist

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

solves https://gitlab.com/gitlab-org/gitlab/-/issues/432688

Edited by Gosia Ksionek

Merge request reports

Loading