Add AiTracking for Code Review Summary

What does this MR do and why?

Registers a summarize_review internal event and fires it from Llm::MergeRequests::SummarizeReviewService, so Duo merge-request review-summary generation lands in ai_usage_events. Today this Duo feature emits no AiTracking event, so it is invisible to AiUsageData, AiUserMetrics, and the Duo and SDLC Trends dashboard. This closes the Code Review Summary row of the audit at #567159.

The event follows the established Duo tracking convention:

  • ee/config/events/summarize_review.yml: the InternalEvents definition. No extra_trackers block, since Gitlab::Tracking::AiTracking is a default tracker for every EE event.
  • ee/lib/gitlab/tracking/ai_tracking.rb: registry entry (event id 36; ids 32-35 are reserved by the in-flight !240198, !240662 (merged), !240999 (closed), !241057 (closed)).
  • The service uses the Gitlab::InternalEventsTracking concern and calls track_internal_event at entry of #perform, passing user + project only. InternalEvents derives the namespace from the project and AiTracking derives namespace_id, so namespace is not passed explicitly (matches duo_code_review_chat_worker, troubleshoot_job).
  • GraphQL enum value + regenerated reference docs and introspection schema.

The resource is the MergeRequest; the service schedules completion asynchronously, so the event is tracked at entry, mirroring Llm::ChatService#perform.

Tracks #567159.

How to set up and validate locally

bundle exec rspec ee/spec/services/llm/merge_requests/summarize_review_service_spec.rb

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

Edited by Andrew Dunn

Merge request reports

Loading