Skip to content

Replace current import usage counters by Import count metrics

Problem

Usage counters under usage_activity_by_stage_manage have been incorrectly changed to count unique users, instead of counting import actions. These counters need to be updated to again count import actions.

Proposal

  • Clean up current counters to only count import actions (not unique users):
          bulk_imports: {
            gitlab: distinct_count(::BulkImport.where(time_period, source_type: :gitlab), :user_id)
          },
          projects_imported: {
            total: distinct_count(::Project.where(time_period).where.not(import_type: nil), :creator_id),
            gitlab_project: projects_imported_count('gitlab_project', time_period),
            gitlab: projects_imported_count('gitlab', time_period),
            github: projects_imported_count('github', time_period),
            bitbucket: projects_imported_count('bitbucket', time_period),
            bitbucket_server: projects_imported_count('bitbucket_server', time_period),
            gitea: projects_imported_count('gitea', time_period),
            git: projects_imported_count('git', time_period),
            manifest: projects_imported_count('manifest', time_period)
          },
          issues_imported: {
            jira: distinct_count(::JiraImportState.where(time_period), :user_id),
            fogbugz: projects_imported_count('fogbugz', time_period),
            phabricator: projects_imported_count('phabricator', time_period),
            csv: distinct_count(Issues::CsvImport.where(time_period), :user_id)
          },
          groups_imported: distinct_count(::GroupImportState.where(time_period), :user_id)

https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/usage_data.rb#L585

Edited by Kassio Borges