Commit 3c383699 authored by Adam Hegyi's avatar Adam Hegyi

Usage data for customized VSM stages

parent f143d46a
# frozen_string_literal: true
class AddIndexForGroupVsmUsagePing < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_NAME = 'index_analytics_cycle_analytics_group_stages_custom_only'
disable_ddl_transaction!
def up
add_concurrent_index :analytics_cycle_analytics_group_stages, :id, where: 'custom = true', name: INDEX_NAME
end
def down
remove_concurrent_index_by_name :analytics_cycle_analytics_group_stages, INDEX_NAME
end
end
......@@ -8520,6 +8520,8 @@ CREATE INDEX index_analytics_ca_project_stages_on_relative_position ON public.an
CREATE INDEX index_analytics_ca_project_stages_on_start_event_label_id ON public.analytics_cycle_analytics_project_stages USING btree (start_event_label_id);
CREATE INDEX index_analytics_cycle_analytics_group_stages_custom_only ON public.analytics_cycle_analytics_group_stages USING btree (id) WHERE (custom = true);
CREATE INDEX index_application_settings_on_custom_project_templates_group_id ON public.application_settings USING btree (custom_project_templates_group_id);
CREATE INDEX index_application_settings_on_file_template_project_id ON public.application_settings USING btree (file_template_project_id);
......@@ -12909,5 +12911,6 @@ COPY "schema_migrations" (version) FROM STDIN;
20200326135443
20200326144443
20200326145443
20200330074719
\.
---
title: Usage ping for customized Value Stream Management stage count
merge_request: 28308
author:
type: added
......@@ -244,7 +244,8 @@ module EE
groups: distinct_count(::GroupMember.where(time_period), :user_id),
ldap_keys: distinct_count(::LDAPKey.where(time_period), :user_id),
ldap_users: distinct_count(::GroupMember.of_ldap_type.where(time_period), :user_id),
users_created: count(::User.where(time_period))
users_created: count(::User.where(time_period)),
value_stream_management_customized_group_stages: count(::Analytics::CycleAnalytics::GroupStage.where(custom: true))
}
end
......
......@@ -384,6 +384,7 @@ describe Gitlab::UsageData do
create(:group_member, user: user)
create(:key, type: 'LDAPKey', user: user)
create(:group_member, ldap: true, user: user)
create(:cycle_analytics_group_stage)
end
expect(described_class.uncached_data[:usage_activity_by_stage][:manage]).to eq(
......@@ -391,14 +392,16 @@ describe Gitlab::UsageData do
groups: 2,
ldap_keys: 2,
ldap_users: 2,
users_created: 6
users_created: 6,
value_stream_management_customized_group_stages: 2
)
expect(described_class.uncached_data[:usage_activity_by_stage_monthly][:manage]).to eq(
events: 1,
groups: 1,
ldap_keys: 1,
ldap_users: 1,
users_created: 4
users_created: 4,
value_stream_management_customized_group_stages: 2
)
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