Loading
Add ai_governance_session_id to ClickHouse ai_audit_events
What does this MR do and why?
On GitLab.com, AI audit events are read from ClickHouse. The ClickHouse ai_audit_events table has no session column, so events cannot be looked up by session.
This MR:
- Adds an
ai_governance_session_idcolumn (0means no session) and aby_ai_governance_session_idprojection to the ClickHouse table. The projection is materialized so older data can be read by session too. - Sends the session id in the row written to ClickHouse.
References
- Resolves https://gitlab.com/gitlab-org/gitlab/-/work_items/630663
- Postgres counterpart: !256738 (merged)
Screenshots or screen recordings
Not applicable. No UI changes.
How to set up and validate locally
- Run
bundle exec rake gitlab:clickhouse:migrate. - Check the new column and projection exist:
SELECT name FROM system.projections WHERE table = 'ai_audit_events'; - Run
bundle exec rake gitlab:clickhouse:rollback:main STEP=1and check both are removed.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.