Add AiTracking for Duo Chat tool calls
What does this MR do and why?
Web Chat already emits tool_succeeded_duo_chat and tool_failed_duo_chat. Those events never reached ClickHouse because they were not registered in AiTracking.
This registers them as event IDs 48 and 49 and allowlists session_id, tool_name, flow_type, trigger_source, and model in extras. After this ships, someone with ClickHouse access can list the tools used in a given chat session.
This does not add GLQL dimensions. Tool names stay in extras, same as MCP tool calls.
Because these are registered under the chat feature, Chat event totals (for example totalEventCount in user metrics) will now include tool calls. The Duo Chat adoption count is unaffected since it only counts request_duo_chat_response.
References
Screenshots or screen recordings
Not applicable. Tracking-only change, no UI.
How to set up and validate locally
- Enable ClickHouse in GDK if it is not already on.
- In rails console:
Gitlab::InternalEvents.track_event( 'tool_succeeded_duo_chat', user: User.first, project: Project.first, additional_properties: { session_id: '42', tool_name: 'create_issue', flow_type: 'chat', trigger_source: 'web_chat', model: 'claude-3-5-sonnet' } ) - Confirm extras on the stored event:
Expected extras include integer
Ai::UsageEvent.last.slice('event', 'extras')session_id: 42,tool_name: "create_issue", andmodel: "claude-3-5-sonnet". - After the ClickHouse write buffer flushes, the same row should appear in
ai_usage_eventsas event48.
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.