Send globally unique instance and user IDs to AI gateway
What does this MR do and why?
Send hashed instance and user IDs to AI gateway for tracking purposes. We want these IDs to be:
- Globally unique
- As stable as can be
- Work for both SM and SaaS
- Hard to trace back to original user
The solution we landed on is:
-
Global instance ID:
CurrentSetting.uuid
, which is already used forService Ping
, and which is populated as part ofApplicationSettings
so should always exist. -
Global user ID:
Base64(SHA256(uuid, salt, user.id))
; since the numeric user ID is locally unique to an instance and the UUID is globally unique, they will hash to a unique global UID.
We send these in two new custom headers:
X-Gitlab-Instance-Id
X-Gitlab-Global-User-Id
The gateway can then log these in access logs and/or track them with Snowplow (see gitlab-org/modelops/applied-ml/code-suggestions/ai-assist#192 (closed)).
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.
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.
Related to #416621
Edited by Matthias Käppler