diff --git a/config/metrics/counts_28d/20210216180321_action_monthly_active_users_sfe_edit.yml b/config/metrics/counts_28d/20210216180321_action_monthly_active_users_sfe_edit.yml index 8dbf5e5ba41a01c5ef617d11ce4a5a76b6f01b3f..592b02c84bc0db503b6644a3156b0f22ee23d27a 100644 --- a/config/metrics/counts_28d/20210216180321_action_monthly_active_users_sfe_edit.yml +++ b/config/metrics/counts_28d/20210216180321_action_monthly_active_users_sfe_edit.yml @@ -7,7 +7,9 @@ product_stage: create product_group: editor product_category: web_ide value_type: number -status: active +status: removed +removed_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/113551 +milestone_removed: 15.10 time_frame: 28d data_source: redis_hll distribution: diff --git a/config/metrics/counts_28d/20210216180323_action_monthly_active_users_snippet_editor_edit.yml b/config/metrics/counts_28d/20210216180323_action_monthly_active_users_snippet_editor_edit.yml index 5a2d9c197cee836f3dbe46b88ddcd1cc1630386c..012f9db8c80b5e1452943d1ae41f5f0105e24b61 100644 --- a/config/metrics/counts_28d/20210216180323_action_monthly_active_users_snippet_editor_edit.yml +++ b/config/metrics/counts_28d/20210216180323_action_monthly_active_users_snippet_editor_edit.yml @@ -7,7 +7,9 @@ product_stage: create product_group: editor product_category: snippets value_type: number -status: active +status: removed +removed_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/113551 +milestone_removed: 15.10 time_frame: 28d data_source: redis_hll distribution: diff --git a/lib/gitlab/usage_data.rb b/lib/gitlab/usage_data.rb index 20aafa277f126d61c5c30fd455e0e165e9034017..52b8d70c1132fa0443640632251bbe64afe22580 100644 --- a/lib/gitlab/usage_data.rb +++ b/lib/gitlab/usage_data.rb @@ -448,10 +448,7 @@ def usage_activity_by_stage_create(time_period) remote_mirrors: distinct_count(::Project.with_remote_mirrors.where(time_period), :creator_id), snippets: distinct_count(::Snippet.where(time_period), :author_id) }.tap do |h| - if time_period.present? - h[:merge_requests_users] = merge_requests_users(time_period) - h.merge!(action_monthly_active_users(time_period)) - end + h[:merge_requests_users] = merge_requests_users(time_period) if time_period.present? end end # rubocop: enable CodeReuse/ActiveRecord @@ -565,16 +562,6 @@ def usage_activity_by_stage_secure(time_period) {} end - def action_monthly_active_users(time_period) - counter = Gitlab::UsageDataCounters::EditorUniqueCounter - date_range = { date_from: time_period[:created_at].first, date_to: time_period[:created_at].last } - - { - action_monthly_active_users_sfe_edit: redis_usage_data { counter.count_sfe_edit_actions(**date_range) }, - action_monthly_active_users_snippet_editor_edit: redis_usage_data { counter.count_snippet_editor_edit_actions(**date_range) } - } - end - def with_metadata result = nil error = nil diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb index 6f445de8aeea8b8cb6c55e3cb3597a888ba86657..d529319e6e98f49d7bf50c193b3f85073437e0fc 100644 --- a/spec/lib/gitlab/usage_data_spec.rb +++ b/spec/lib/gitlab/usage_data_spec.rb @@ -1047,41 +1047,6 @@ def for_defined_days_back(days: [31, 3]) end end - describe '#action_monthly_active_users', :clean_gitlab_redis_shared_state do - let(:time_period) { { created_at: 2.days.ago..time } } - let(:time) { Time.zone.now } - let(:user1) { build(:user, id: 1) } - let(:user2) { build(:user, id: 2) } - let(:user3) { build(:user, id: 3) } - let(:user4) { build(:user, id: 4) } - let(:project) { build(:project) } - - before do - counter = Gitlab::UsageDataCounters::EditorUniqueCounter - - counter.track_web_ide_edit_action(author: user1, project: project) - counter.track_web_ide_edit_action(author: user1, project: project) - counter.track_sfe_edit_action(author: user1, project: project) - counter.track_snippet_editor_edit_action(author: user1, project: project) - counter.track_snippet_editor_edit_action(author: user1, time: time - 3.days, project: project) - - counter.track_web_ide_edit_action(author: user2, project: project) - counter.track_sfe_edit_action(author: user2, project: project) - - counter.track_web_ide_edit_action(author: user3, time: time - 3.days, project: project) - counter.track_snippet_editor_edit_action(author: user3, project: project) - end - - it 'returns the distinct count of user actions within the specified time period' do - expect(described_class.action_monthly_active_users(time_period)).to eq( - { - action_monthly_active_users_sfe_edit: 2, - action_monthly_active_users_snippet_editor_edit: 2 - } - ) - end - end - describe '.service_desk_counts' do subject { described_class.send(:service_desk_counts) }