Add `Duo Chat: Unique Users` panel to AI impact dashboard

What does this MR do and why?

Adds the Duo Chat: Unique users with the existing duo_pro_usage_rate_over_time visualization, and updates the existing Duo seats: Assigned and used panel to a new duo_chat_addon_usage visualization.

When Duo seats: Assigned and used was added, it was incorrectly given the data meant to be rendered in Duo Chat: Unique users. Now that we're adding the 2nd panel, we are updating it to render the expected data. See thread for more info.

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

Before After
Screenshot_2024-08-28_at_3.01.49_PM Screenshot_2024-08-30_at_11.54.20_AM

with insufficient permissions

Screenshot_2024-08-30_at_11.54.59_AM

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

To mock the purchased seats for the Duo seats: Assigned and used panel, you can mock the GraphQL resolver with this diff:

diff --git a/ee/app/graphql/types/gitlab_subscriptions/add_on_purchase_type.rb b/ee/app/graphql/types/gitlab_subscriptions/add_on_purchase_type.rb
index 0ec750f25164..79715da904c2 100644
--- a/ee/app/graphql/types/gitlab_subscriptions/add_on_purchase_type.rb
+++ b/ee/app/graphql/types/gitlab_subscriptions/add_on_purchase_type.rb
@@ -21,9 +21,12 @@ class AddOnPurchaseType < Types::BaseObject
 
       alias_method :add_on_purchase, :object
 
+      def purchased_quantity
+        200
+      end
+
       def assigned_quantity
-        context[:assigned_add_on_counts] ||= {}
-        context[:assigned_add_on_counts][add_on_purchase.id] ||= add_on_purchase.assigned_users.size
+        150
       end
 
       def name

Related to #468304 (closed)

Edited by Alex Pennells

Merge request reports

Loading