Commit 6b807382 authored by Jarka Košanová's avatar Jarka Košanová

Merge branch 'issue_211837' into 'master'

Add issues with health status to usage data

See merge request gitlab-org/gitlab!28964
parents 144430cc 54477d44
# frozen_string_literal: true
class AddIndexToIssuesHealthStatus < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_NAME = 'idx_issues_on_health_status_not_null'
disable_ddl_transaction!
def up
add_concurrent_index(
:issues,
:health_status,
where: 'health_status IS NOT NULL',
name: INDEX_NAME
)
end
def down
remove_concurrent_index_by_name(:issues, INDEX_NAME)
end
end
......@@ -8587,6 +8587,8 @@ CREATE UNIQUE INDEX idx_environment_merge_requests_unique_index ON public.deploy
CREATE INDEX idx_geo_con_rep_updated_events_on_container_repository_id ON public.geo_container_repository_updated_events USING btree (container_repository_id);
CREATE INDEX idx_issues_on_health_status_not_null ON public.issues USING btree (health_status) WHERE (health_status IS NOT NULL);
CREATE INDEX idx_issues_on_project_id_and_created_at_and_id_and_state_id ON public.issues USING btree (project_id, created_at, id, state_id);
CREATE INDEX idx_issues_on_project_id_and_due_date_and_id_and_state_id ON public.issues USING btree (project_id, due_date, id, state_id) WHERE (due_date IS NOT NULL);
......@@ -13164,6 +13166,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200406171857
20200406172135
20200406192059
20200406193427
20200407094005
20200407094923
20200408110856
......
......@@ -222,6 +222,7 @@ but commented out to help encourage others to add to it in the future. -->
|issues_with_associated_zoom_link|counts||
|issues_using_zoom_quick_actions|counts||
|issues_with_embedded_grafana_charts_approx|counts||
|issues_with_health_status|counts||
|keys|counts||
|label_lists|counts||
|lfs_objects|counts||
......
......@@ -27,6 +27,7 @@ module EE
end
scope :on_status_page, -> { joins(project: :status_page_setting).where(status_page_settings: { enabled: true }).public_only }
scope :counts_by_health_status, -> { reorder(nil).group(:health_status).count }
scope :with_health_status, -> { where.not(health_status: nil) }
has_one :epic_issue
has_one :epic, through: :epic_issue
......
---
title: Add health status counts to usage data
merge_request: 28964
author:
type: other
......@@ -147,6 +147,7 @@ module EE
feature_flags: count(Operations::FeatureFlag),
geo_nodes: count(::GeoNode),
ldap_group_links: count(::LdapGroupLink),
issues_with_health_status: count(::Issue.with_health_status),
ldap_keys: count(::LDAPKey),
ldap_users: count(::User.ldap, 'users.id'),
pod_logs_usages_total: ::Gitlab::UsageCounters::PodLogs.usage_totals[:total],
......
......@@ -38,6 +38,10 @@ describe Gitlab::UsageData do
create(:project_tracing_setting, project: projects[0])
create(:operations_feature_flag, project: projects[0])
create(:issue, project: projects[1])
create(:issue, health_status: :on_track, project: projects[1])
create(:issue, health_status: :at_risk, project: projects[1])
# for group_view testing
create(:user) # user with group_view = NULL (should be counted as having default value 'details')
create(:user, group_view: :details)
......@@ -83,6 +87,7 @@ describe Gitlab::UsageData do
epics_deepest_relationship_level
feature_flags
geo_nodes
issues_with_health_status
ldap_group_links
ldap_keys
ldap_users
......@@ -116,6 +121,7 @@ describe Gitlab::UsageData do
expect(count_data[:feature_flags]).to eq(1)
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)
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