Commit 54aba1a8 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch '227238-jira-issues-usage-ping-data' into 'master'

Usage ping data: Add Jira issues enabled counter

Closes #227238

See merge request gitlab-org/gitlab!36736
parents 909bdb95 3490dbbd
......@@ -525,6 +525,7 @@ appear to be associated to any of the services running, since they all appear to
| `projects_jira_cloud_active` | `counts` | | | | |
| `projects_jira_dvcs_cloud_active` | `counts` | | | | |
| `projects_jira_dvcs_server_active` | `counts` | | | | |
| `projects_jira_issuelist_active` | `counts` | `create` | | EE | Total Jira Issue feature enabled |
| `labels` | `counts` | | | | |
| `merge_requests` | `counts` | | | | |
| `merge_requests_users` | `counts` | | | | |
......
......@@ -194,7 +194,8 @@ module EE
def jira_usage
super.merge(
projects_jira_dvcs_cloud_active: count(ProjectFeatureUsage.with_jira_dvcs_integration_enabled),
projects_jira_dvcs_server_active: count(ProjectFeatureUsage.with_jira_dvcs_integration_enabled(cloud: false))
projects_jira_dvcs_server_active: count(ProjectFeatureUsage.with_jira_dvcs_integration_enabled(cloud: false)),
projects_jira_issuelist_active: projects_jira_issuelist_active
)
end
......@@ -345,6 +346,15 @@ module EE
def ldap_available_servers
::Gitlab::Auth::Ldap::Config.available_servers
end
# rubocop:disable CodeReuse/ActiveRecord
def projects_jira_issuelist_active
min_id = JiraTrackerData.where(issues_enabled: true).minimum(:service_id)
max_id = JiraTrackerData.where(issues_enabled: true).maximum(:service_id)
count(JiraService.active.includes(:jira_tracker_data).where(jira_tracker_data: { issues_enabled: true }), start: min_id, finish: max_id)
end
# rubocop:enable CodeReuse/ActiveRecord
end
end
end
......
......@@ -33,6 +33,7 @@ RSpec.describe Gitlab::UsageData do
create(:prometheus_alert, project: projects[1])
create(:service, project: projects[1], type: 'JenkinsService', active: true)
create(:jira_service, project: projects[0], issues_enabled: true, project_key: 'GL')
create(:package, project: projects[0])
create(:package, project: projects[0])
......@@ -105,6 +106,7 @@ RSpec.describe Gitlab::UsageData do
projects_jenkins_active
projects_jira_dvcs_cloud_active
projects_jira_dvcs_server_active
projects_jira_issuelist_active
projects_mirrored_with_pipelines_enabled
projects_reporting_ci_cd_back_to_github
projects_with_packages
......@@ -130,6 +132,7 @@ RSpec.describe Gitlab::UsageData do
expect(count_data[:status_page_projects]).to eq(1)
expect(count_data[:status_page_issues]).to eq(1)
expect(count_data[:issues_with_health_status]).to eq(2)
expect(count_data[:projects_jira_issuelist_active]).to eq(1)
end
it 'has integer value for epic relationship level' do
......
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