Add source application to AI Gateway request_unit_primitive events

Problem

In the world of AI Gateway/Duo reporting, it would be very valuable to be able to understand the source application of where users are interacting with Duo features, e.g. the instance or the specific IDE extension. (Additional context here). Right now this will not be possible using the new AI Gateway request_{unit_primitive} events because this value is not passed.

Example values proposed in the linked issue:

  • GitLab web application
  • VS Code
  • WebIDE
  • JetBrains
  • Visual Studio
  • CLI

Desired Outcome

Use the GitLab Standard context to record the original source of an event and include it on the AI Gateway events. (I'm referring to the request_{unit_primitive} events instrumented in this MR.

Note: Whatever value we use for recording this information should not be pseudonymized and therefore should be added to the allowlist like we did for other fields in this MR

Potential Solution

  • Use the existing source attribute in the standard context, as it source otherwise does not provide much value.
  • Pass the source via a header attribute within requests to AI gateway e.g.:
    • gitlab-javascript
    • gitlab-rails
    • gitlab-cli
    • gitlab-vscode
    • gitlab-jetbrains
    • gitlab-visual-studio
    • gitlab-web-ide
  • Populate any internal event with the passed source parameter

How to verify

  • source values are sent on the AI Gateway request events
  • When looking at the data in Snowflake, source is human-readable/not pseudonymized

Further actions needed

Edited by Sebastian Rehm