Skip to content

Add Duo Pro seats panel to AI impact analytics dashboard

Alex Pennells requested to merge 460832-duo-seats-tile into master

What does this MR do and why?

Adds a new Duo Pro seat usage panel to the Ai Impact analytics dashboard

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
Screenshot_2024-08-02_at_2.19.05_PM Screenshot_2024-08-02_at_2.49.12_PM

How to set up and validate locally

  1. Ensure that you are using GitLab Ultimate
  2. Configure your GDK to use ClickHouse
# enable clickhouse
Feature.enable(:clickhouse_data_collection)
Feature.enable(:event_sync_worker_for_click_house)

# enable the worker to sync code suggestions events to clickhouse
Feature.enable(:code_suggestion_events_in_click_house)
  1. Seed AI analytics data: FILTER=ai_usage_stats bundle exec rake db:seed_fu
  2. Create a new group
  3. Navigate to the Analytics dashboard page for the new group (ex. http://gdk.test:3000/groups/flightjs/-/analytics/dashboards)
  4. Select the AI impact analytics dashboard

Note: The seeded analytics data does not mock the number of Duo Pro seats included in your subscription. The metric will show as 0% if this number is 0. It can be mocked by applying the diff below

diff --git a/ee/app/services/analytics/ai_analytics/ai_metrics_service.rb b/ee/app/services/analytics/ai_analytics/ai_metrics_service.rb
index e08932914ce2..361191fb541a 100644
--- a/ee/app/services/analytics/ai_analytics/ai_metrics_service.rb
+++ b/ee/app/services/analytics/ai_analytics/ai_metrics_service.rb
@@ -31,7 +31,7 @@ def add_duo_pro_assigned(data)
         users = GitlabSubscriptions::AddOnAssignedUsersFinder.new(
           current_user, namespace, add_on_name: :code_suggestions).execute
 
-        data.merge(duo_pro_assigned_users_count: users.count)
+        data.merge(duo_pro_assigned_users_count: 100)
       end
 
       def add_code_suggestions_usage(data)

Related to #460832

Edited by Alex Pennells

Merge request reports