Skip to content

Add event definitions for GitLab Duo usage page tracking

What does this MR do and why?

Resolves #479509

!158497 (merged) introduces an internal event called pageview for the duo pro usage page, but without event definition, that causes the track_event request to return 422 error with response: Unknown event: pageview. This MR fixes that.

You can see the errors from staging and production in Sentry: https://new-sentry.gitlab.net/organizations/gitlab/issues/?environment=gstg&environment=gprd&project=3&query=is%3Aunresolved+Unknown+event&referrer=issue-list&statsPeriod=14d

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. Have an EE licensed local gdk: https://handbook.gitlab.com/handbook/engineering/developer-onboarding/#working-on-gitlab-ee-developer-licenses
  2. Check out master
  3. Create a new group and run the following in rails console to create an active duo pro trial for the group
GitlabSubscriptions::AddOn.find_or_create_by(name: 'code_suggestions', description: GitlabSubscriptions::AddOn.descriptions[:code_suggestions])
GitlabSubscriptions::AddOnPurchase.create(subscription_add_on_id: GitlabSubscriptions::AddOn.find_by(name: 'code_suggestions').id, namespace: Group.last, organization_id: 1, started_at: 60.days.ago, expires_on: 5.days.ago, trial: true, quantity: 1, purchase_xid: '1')
  1. Go to /groups//-/usage_quotas#code-suggestions-usage-tab and in dev tool, you should see a track_event request with status 422.
  2. Check out this branch and restart gdk rails
  3. Refresh the page and in dev tool, you should see a track_event request with status 200.
Edited by Roy Liu

Merge request reports