diff options
Diffstat (limited to 'lib/gitlab/import/metrics.rb')
-rw-r--r-- | lib/gitlab/import/metrics.rb | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/lib/gitlab/import/metrics.rb b/lib/gitlab/import/metrics.rb index 7a0cf1682a6..8263df3dc37 100644 --- a/lib/gitlab/import/metrics.rb +++ b/lib/gitlab/import/metrics.rb @@ -32,6 +32,14 @@ module Gitlab return unless project.github_import? track_usage_event(:github_import_project_failure, project.id) + track_import_state('github', 'Import::GithubService') + end + + def track_canceled_import + return unless project.github_import? + + track_usage_event(:github_import_project_cancelled, project.id) + track_import_state('github', 'Import::GithubService') end def issues_counter @@ -75,7 +83,25 @@ module Gitlab def track_finish_metric return unless project.github_import? - track_usage_event(:github_import_project_success, project.id) + track_import_state('github', 'Import::GithubService') + + case project.beautified_import_status_name + when 'partially completed' + track_usage_event(:github_import_project_partially_completed, project.id) + when 'completed' + track_usage_event(:github_import_project_success, project.id) + end + end + + def track_import_state(type, category) + Gitlab::Tracking.event( + category, + 'create', + label: "#{type}_import_project_state", + project: project, + import_type: type, + state: project.beautified_import_status_name + ) end end end |