Commit fc28148b authored by Josianne Hyson's avatar Josianne Hyson

Add Group migration imports to usage data

We want to be able to report on how many unique users are using the
BulkImport feature, so that we can determine the adoption rate of this
feature.

Add this data to the usage data model that is reported in the usage
ping.

Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/249169
MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45536
parent 1864450e
---
title: Add usage ping for unique users importing groups and projects via the group
migration tool
merge_request: 45536
author:
type: changed
...@@ -564,6 +564,9 @@ module Gitlab ...@@ -564,6 +564,9 @@ module Gitlab
users_created: count(::User.where(time_period), start: user_minimum_id, finish: user_maximum_id), users_created: count(::User.where(time_period), start: user_minimum_id, finish: user_maximum_id),
omniauth_providers: filtered_omniauth_provider_names.reject { |name| name == 'group_saml' }, omniauth_providers: filtered_omniauth_provider_names.reject { |name| name == 'group_saml' },
user_auth_by_provider: distinct_count_user_auth_by_provider(time_period), user_auth_by_provider: distinct_count_user_auth_by_provider(time_period),
bulk_imports: {
gitlab: distinct_count(::BulkImport.where(time_period, source_type: :gitlab), :user_id)
},
projects_imported: { projects_imported: {
gitlab_project: projects_imported_count('gitlab_project', time_period), gitlab_project: projects_imported_count('gitlab_project', time_period),
gitlab: projects_imported_count('gitlab', time_period), gitlab: projects_imported_count('gitlab', time_period),
......
...@@ -201,6 +201,8 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do ...@@ -201,6 +201,8 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
for_defined_days_back do for_defined_days_back do
user = create(:user) user = create(:user)
create(:bulk_import, user: user)
%w(gitlab_project gitlab github bitbucket bitbucket_server gitea git manifest fogbugz phabricator).each do |type| %w(gitlab_project gitlab github bitbucket bitbucket_server gitea git manifest fogbugz phabricator).each do |type|
create(:project, import_type: type, creator_id: user.id) create(:project, import_type: type, creator_id: user.id)
end end
...@@ -211,6 +213,9 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do ...@@ -211,6 +213,9 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
expect(described_class.usage_activity_by_stage_manage({})).to include( expect(described_class.usage_activity_by_stage_manage({})).to include(
{ {
bulk_imports: {
gitlab: 2
},
projects_imported: { projects_imported: {
gitlab_project: 2, gitlab_project: 2,
gitlab: 2, gitlab: 2,
...@@ -230,6 +235,9 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do ...@@ -230,6 +235,9 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
) )
expect(described_class.usage_activity_by_stage_manage(described_class.last_28_days_time_period)).to include( expect(described_class.usage_activity_by_stage_manage(described_class.last_28_days_time_period)).to include(
{ {
bulk_imports: {
gitlab: 1
},
projects_imported: { projects_imported: {
gitlab_project: 1, gitlab_project: 1,
gitlab: 1, gitlab: 1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment