Commit 15481fe9 authored by Arturo Herrero's avatar Arturo Herrero

Usage ping data: Add Jira issues enabled counter

As part of https://gitlab.com/groups/gitlab-org/-/epics/3622, we need to
add an item to the usage ping payload that indicates how many projects
currently have this feature enabled.
parent bfadedb5
...@@ -525,6 +525,7 @@ appear to be associated to any of the services running, since they all appear to ...@@ -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_cloud_active` | `counts` | | | | |
| `projects_jira_dvcs_cloud_active` | `counts` | | | | | | `projects_jira_dvcs_cloud_active` | `counts` | | | | |
| `projects_jira_dvcs_server_active` | `counts` | | | | | | `projects_jira_dvcs_server_active` | `counts` | | | | |
| `projects_jira_issuelist_active` | `counts` | `create` | | EE | Total Jira Issue feature enabled |
| `labels` | `counts` | | | | | | `labels` | `counts` | | | | |
| `merge_requests` | `counts` | | | | | | `merge_requests` | `counts` | | | | |
| `merge_requests_users` | `counts` | | | | | | `merge_requests_users` | `counts` | | | | |
......
...@@ -194,7 +194,8 @@ module EE ...@@ -194,7 +194,8 @@ module EE
def jira_usage def jira_usage
super.merge( super.merge(
projects_jira_dvcs_cloud_active: count(ProjectFeatureUsage.with_jira_dvcs_integration_enabled), 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: count(JiraService.active.includes(:jira_tracker_data).where(jira_tracker_data: { issues_enabled: true })) # rubocop:disable CodeReuse/ActiveRecord
) )
end end
......
...@@ -33,6 +33,7 @@ RSpec.describe Gitlab::UsageData do ...@@ -33,6 +33,7 @@ RSpec.describe Gitlab::UsageData do
create(:prometheus_alert, project: projects[1]) create(:prometheus_alert, project: projects[1])
create(:service, project: projects[1], type: 'JenkinsService', active: true) 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])
create(:package, project: projects[0]) create(:package, project: projects[0])
...@@ -105,6 +106,7 @@ RSpec.describe Gitlab::UsageData do ...@@ -105,6 +106,7 @@ RSpec.describe Gitlab::UsageData do
projects_jenkins_active projects_jenkins_active
projects_jira_dvcs_cloud_active projects_jira_dvcs_cloud_active
projects_jira_dvcs_server_active projects_jira_dvcs_server_active
projects_jira_issuelist_active
projects_mirrored_with_pipelines_enabled projects_mirrored_with_pipelines_enabled
projects_reporting_ci_cd_back_to_github projects_reporting_ci_cd_back_to_github
projects_with_packages projects_with_packages
...@@ -130,6 +132,7 @@ RSpec.describe Gitlab::UsageData do ...@@ -130,6 +132,7 @@ RSpec.describe Gitlab::UsageData do
expect(count_data[:status_page_projects]).to eq(1) expect(count_data[:status_page_projects]).to eq(1)
expect(count_data[:status_page_issues]).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[:issues_with_health_status]).to eq(2)
expect(count_data[:projects_jira_issuelist_active]).to eq(1)
end end
it 'has integer value for epic relationship level' do it 'has integer value for epic relationship level' do
......
...@@ -77,13 +77,16 @@ FactoryBot.define do ...@@ -77,13 +77,16 @@ FactoryBot.define do
username { 'jira_username' } username { 'jira_username' }
password { 'jira_password' } password { 'jira_password' }
jira_issue_transition_id { '56-1' } jira_issue_transition_id { '56-1' }
issues_enabled { false }
project_key { nil }
end end
after(:build) do |service, evaluator| after(:build) do |service, evaluator|
if evaluator.create_data if evaluator.create_data
create(:jira_tracker_data, service: service, create(:jira_tracker_data, service: service,
url: evaluator.url, api_url: evaluator.api_url, jira_issue_transition_id: evaluator.jira_issue_transition_id, url: evaluator.url, api_url: evaluator.api_url, jira_issue_transition_id: evaluator.jira_issue_transition_id,
username: evaluator.username, password: evaluator.password username: evaluator.username, password: evaluator.password, issues_enabled: evaluator.issues_enabled,
project_key: evaluator.project_key
) )
end end
end end
......
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