Track Code Suggestions authentication
What does this MR do and why?
Related to https://gitlab.com/gitlab-org/gitlab/-/issues/412542
We want to track Code Suggestions authentication events for authenticated users.
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
- Get a running Snowplow micro service
- Enable the Code Suggestions API for the instance & user. Substitute "root" with the username of the user that you will be using for tests:
Feature.enable(:ai_assist_api)
Feature.enable(:ai_assist_flag)
ApplicationSetting.last.update!(instance_level_code_suggestions_enabled: true)
u = User.find_by_username('root')
u.namespace.update(code_suggestions: true)
- Get a personal access token for the user
- Run these curl commands:
curl http://127.0.0.1:3000/api/v4/ml/ai-assist?private_token=YOUR_ACCESS_TOKEN
curl -X POST http://127.0.0.1:3000/api/v4/code_suggestions/tokens?private_token=YOUR_ACCESS_TOKEN
- Now, when checking
http://localhost:9091/micro/good
for Snowplow events, you should see two new events triggered with anauthenticate
action mentioned in their payload and appropriatecategory
for each of the two tested API classes.
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.
Edited by Michał Wielich