From 0cd7ebf717970f9db9298e49959bbbc78bc17342 Mon Sep 17 00:00:00 2001 From: Logan King Date: Mon, 25 Mar 2019 07:42:08 +0000 Subject: [PATCH] Add error tracking usage counts --- changelogs/unreleased/ce-56153-error-tracking-counts.yml | 5 +++++ lib/gitlab/usage_data.rb | 1 + spec/lib/gitlab/usage_data_spec.rb | 4 ++++ 3 files changed, 10 insertions(+) create mode 100644 changelogs/unreleased/ce-56153-error-tracking-counts.yml diff --git a/changelogs/unreleased/ce-56153-error-tracking-counts.yml b/changelogs/unreleased/ce-56153-error-tracking-counts.yml new file mode 100644 index 00000000000..fc3d8c01d7f --- /dev/null +++ b/changelogs/unreleased/ce-56153-error-tracking-counts.yml @@ -0,0 +1,5 @@ +--- +title: Add usage counts for error tracking feature +merge_request: 25472 +author: +type: added diff --git a/lib/gitlab/usage_data.rb b/lib/gitlab/usage_data.rb index f9c9ea4f936..75477c7cf18 100644 --- a/lib/gitlab/usage_data.rb +++ b/lib/gitlab/usage_data.rb @@ -84,6 +84,7 @@ module Gitlab projects: count(Project), projects_imported_from_github: count(Project.where(import_type: 'github')), projects_with_repositories_enabled: count(ProjectFeature.where('repository_access_level > ?', ProjectFeature::DISABLED)), + projects_with_error_tracking_enabled: count(::ErrorTracking::ProjectErrorTrackingSetting.where(enabled: true)), protected_branches: count(ProtectedBranch), releases: count(Release), remote_mirrors: count(RemoteMirror), diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb index cd9e4d48cd1..549cc5ac057 100644 --- a/spec/lib/gitlab/usage_data_spec.rb +++ b/spec/lib/gitlab/usage_data_spec.rb @@ -13,6 +13,8 @@ describe Gitlab::UsageData do create(:service, project: projects[0], type: 'SlackSlashCommandsService', active: true) create(:service, project: projects[1], type: 'SlackService', active: true) create(:service, project: projects[2], type: 'SlackService', active: true) + create(:project_error_tracking_setting, project: projects[0]) + create(:project_error_tracking_setting, project: projects[1], enabled: false) gcp_cluster = create(:cluster, :provided_by_gcp) create(:cluster, :provided_by_user) @@ -117,6 +119,7 @@ describe Gitlab::UsageData do projects_slack_slash_active projects_prometheus_active projects_with_repositories_enabled + projects_with_error_tracking_enabled pages_domains protected_branches releases @@ -146,6 +149,7 @@ describe Gitlab::UsageData do expect(count_data[:projects_slack_notifications_active]).to eq(2) expect(count_data[:projects_slack_slash_active]).to eq(1) expect(count_data[:projects_with_repositories_enabled]).to eq(2) + expect(count_data[:projects_with_error_tracking_enabled]).to eq(1) expect(count_data[:clusters_enabled]).to eq(7) expect(count_data[:project_clusters_enabled]).to eq(6)