Commit ebe204aa authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Move EE issue activity counters to EE

These should not be in CE since these features are EE-only
parent f8e050cf
......@@ -29,10 +29,10 @@ class ResourceTimeboxEvent < ResourceEvent
case self
when ResourceMilestoneEvent
Gitlab::UsageDataCounters::IssueActivityUniqueCounter.track_issue_milestone_changed_action(author: user)
when ResourceIterationEvent
Gitlab::UsageDataCounters::IssueActivityUniqueCounter.track_issue_iteration_changed_action(author: user)
else
# no-op
end
end
end
ResourceTimeboxEvent.prepend_if_ee('EE::ResourceTimeboxEvent')
# frozen_string_literal: true
module EE
module ResourceTimeboxEvent
extend ::Gitlab::Utils::Override
private
override :usage_metrics
def usage_metrics
case self
when ResourceIterationEvent
::Gitlab::UsageDataCounters::IssueActivityUniqueCounter.track_issue_iteration_changed_action(author: user)
else
super
end
end
end
end
......@@ -7,11 +7,36 @@ module EE
extend ActiveSupport::Concern
ISSUE_HEALTH_STATUS_CHANGED = 'g_project_management_issue_health_status_changed'
ISSUE_ITERATION_CHANGED = 'g_project_management_issue_iteration_changed'
ISSUE_WEIGHT_CHANGED = 'g_project_management_issue_weight_changed'
ISSUE_ADDED_TO_EPIC = 'g_project_management_issue_added_to_epic'
ISSUE_REMOVED_FROM_EPIC = 'g_project_management_issue_removed_from_epic'
ISSUE_CHANGED_EPIC = 'g_project_management_issue_changed_epic'
class_methods do
def track_issue_health_status_changed_action(author:, time: Time.zone.now)
track_unique_action(ISSUE_HEALTH_STATUS_CHANGED, author, time)
end
def track_issue_iteration_changed_action(author:, time: Time.zone.now)
track_unique_action(ISSUE_ITERATION_CHANGED, author, time)
end
def track_issue_weight_changed_action(author:, time: Time.zone.now)
track_unique_action(ISSUE_WEIGHT_CHANGED, author, time)
end
def track_issue_added_to_epic_action(author:, time: Time.zone.now)
track_unique_action(ISSUE_ADDED_TO_EPIC, author, time)
end
def track_issue_removed_from_epic_action(author:, time: Time.zone.now)
track_unique_action(ISSUE_REMOVED_FROM_EPIC, author, time)
end
def track_issue_changed_epic_action(author:, time: Time.zone.now)
track_unique_action(ISSUE_CHANGED_EPIC, author, time)
end
end
end
end
......
......@@ -17,4 +17,54 @@ RSpec.describe Gitlab::UsageDataCounters::IssueActivityUniqueCounter, :clean_git
end
end
end
context 'for Issue iteration changed actions' do
it_behaves_like 'a tracked issue edit event' do
let(:action) { described_class::ISSUE_ITERATION_CHANGED }
def track_action(params)
described_class.track_issue_iteration_changed_action(**params)
end
end
end
context 'for Issue weight changed actions' do
it_behaves_like 'a tracked issue edit event' do
let(:action) { described_class::ISSUE_WEIGHT_CHANGED }
def track_action(params)
described_class.track_issue_weight_changed_action(**params)
end
end
end
context 'for Issue added to epic actions' do
it_behaves_like 'a tracked issue edit event' do
let(:action) { described_class::ISSUE_ADDED_TO_EPIC}
def track_action(params)
described_class.track_issue_added_to_epic_action(**params)
end
end
end
context 'for Issue removed from epic actions' do
it_behaves_like 'a tracked issue edit event' do
let(:action) { described_class::ISSUE_REMOVED_FROM_EPIC}
def track_action(params)
described_class.track_issue_removed_from_epic_action(**params)
end
end
end
context 'for Issue changed epic actions' do
it_behaves_like 'a tracked issue edit event' do
let(:action) { described_class::ISSUE_CHANGED_EPIC}
def track_action(params)
described_class.track_issue_changed_epic_action(**params)
end
end
end
end
......@@ -9,14 +9,12 @@ module Gitlab
ISSUE_CREATED = 'g_project_management_issue_created'
ISSUE_CLOSED = 'g_project_management_issue_closed'
ISSUE_DESCRIPTION_CHANGED = 'g_project_management_issue_description_changed'
ISSUE_ITERATION_CHANGED = 'g_project_management_issue_iteration_changed'
ISSUE_LABEL_CHANGED = 'g_project_management_issue_label_changed'
ISSUE_MADE_CONFIDENTIAL = 'g_project_management_issue_made_confidential'
ISSUE_MADE_VISIBLE = 'g_project_management_issue_made_visible'
ISSUE_MILESTONE_CHANGED = 'g_project_management_issue_milestone_changed'
ISSUE_REOPENED = 'g_project_management_issue_reopened'
ISSUE_TITLE_CHANGED = 'g_project_management_issue_title_changed'
ISSUE_WEIGHT_CHANGED = 'g_project_management_issue_weight_changed'
ISSUE_CROSS_REFERENCED = 'g_project_management_issue_cross_referenced'
ISSUE_MOVED = 'g_project_management_issue_moved'
ISSUE_RELATED = 'g_project_management_issue_related'
......@@ -24,9 +22,6 @@ module Gitlab
ISSUE_MARKED_AS_DUPLICATE = 'g_project_management_issue_marked_as_duplicate'
ISSUE_LOCKED = 'g_project_management_issue_locked'
ISSUE_UNLOCKED = 'g_project_management_issue_unlocked'
ISSUE_ADDED_TO_EPIC = 'g_project_management_issue_added_to_epic'
ISSUE_REMOVED_FROM_EPIC = 'g_project_management_issue_removed_from_epic'
ISSUE_CHANGED_EPIC = 'g_project_management_issue_changed_epic'
ISSUE_DESIGNS_ADDED = 'g_project_management_issue_designs_added'
ISSUE_DESIGNS_MODIFIED = 'g_project_management_issue_designs_modified'
ISSUE_DESIGNS_REMOVED = 'g_project_management_issue_designs_removed'
......@@ -78,14 +73,6 @@ module Gitlab
track_unique_action(ISSUE_MILESTONE_CHANGED, author, time)
end
def track_issue_iteration_changed_action(author:, time: Time.zone.now)
track_unique_action(ISSUE_ITERATION_CHANGED, author, time)
end
def track_issue_weight_changed_action(author:, time: Time.zone.now)
track_unique_action(ISSUE_WEIGHT_CHANGED, author, time)
end
def track_issue_cross_referenced_action(author:, time: Time.zone.now)
track_unique_action(ISSUE_CROSS_REFERENCED, author, time)
end
......@@ -114,18 +101,6 @@ module Gitlab
track_unique_action(ISSUE_UNLOCKED, author, time)
end
def track_issue_added_to_epic_action(author:, time: Time.zone.now)
track_unique_action(ISSUE_ADDED_TO_EPIC, author, time)
end
def track_issue_removed_from_epic_action(author:, time: Time.zone.now)
track_unique_action(ISSUE_REMOVED_FROM_EPIC, author, time)
end
def track_issue_changed_epic_action(author:, time: Time.zone.now)
track_unique_action(ISSUE_CHANGED_EPIC, author, time)
end
def track_issue_designs_added_action(author:, time: Time.zone.now)
track_unique_action(ISSUE_DESIGNS_ADDED, author, time)
end
......
......@@ -168,36 +168,6 @@ RSpec.describe Gitlab::UsageDataCounters::IssueActivityUniqueCounter, :clean_git
end
end
context 'for Issue added to epic actions' do
it_behaves_like 'a tracked issue edit event' do
let(:action) { described_class::ISSUE_ADDED_TO_EPIC}
def track_action(params)
described_class.track_issue_added_to_epic_action(**params)
end
end
end
context 'for Issue removed from epic actions' do
it_behaves_like 'a tracked issue edit event' do
let(:action) { described_class::ISSUE_REMOVED_FROM_EPIC}
def track_action(params)
described_class.track_issue_removed_from_epic_action(**params)
end
end
end
context 'for Issue changed epic actions' do
it_behaves_like 'a tracked issue edit event' do
let(:action) { described_class::ISSUE_CHANGED_EPIC}
def track_action(params)
described_class.track_issue_changed_epic_action(**params)
end
end
end
context 'for Issue designs added actions' do
it_behaves_like 'a tracked issue edit event' do
let(:action) { described_class::ISSUE_DESIGNS_ADDED }
......
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