AI Impact: Add GraphQL API for AI Acceptance Rate

What does this MR do and why?

It adds GraphQL API for 2 new fields for Code Suggestions.

  • codeSuggestionsShownCount - total number of code suggestions shown to code contributors in given timeframe
  • codeSuggestionsAcceptedCount - total number of code suggestions accepted by code contributors in given timeframe

With these 2 metrics we can easily calculate Acceptance Rate on frontend.

image

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.

How to set up and validate locally

  1. Setup clickhouse
  2. Enable analytics in clickhouse via Gitlab::CurrentSettings.current_application_settings.update(use_clickhouse_for_analytics: true) Rails console command.
  3. Seed data via FILTER=ai_usage_stats bundle exec rake db:seed_fu terminal ocmmand
  4. Use http://127.0.0.1:3000/-/graphql-explorer to verify that the data is properly shown. See screenshot above for example query

Related to #456088 (closed)

Edited by Pavel Shutsin

Merge request reports

Loading