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
| `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: count(JiraService.active.includes(:jira_tracker_data).where(jira_tracker_data: { issues_enabled: true })) # rubocop:disable CodeReuse/ActiveRecord
)
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
......
......@@ -77,13 +77,16 @@ FactoryBot.define do
username { 'jira_username' }
password { 'jira_password' }
jira_issue_transition_id { '56-1' }
issues_enabled { false }
project_key { nil }
end
after(:build) do |service, evaluator|
if evaluator.create_data
create(:jira_tracker_data, service: service,
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
......
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