Commit 9ed800a8 authored by Matthias Käppler's avatar Matthias Käppler

Merge branch 'issue_292253-epic_issue_moved' into 'master'

Track epic issue moved from project

See merge request gitlab-org/gitlab!58590
parents 85d82d73 d8957eb4
...@@ -9896,6 +9896,30 @@ Status: `implemented` ...@@ -9896,6 +9896,30 @@ Status: `implemented`
Tiers: `premium`, `ultimate` Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_epic_issue_moved_from_project_monthly`
Counts of MAU moving epic issues between projects
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_28d/20210405190240_g_project_management_epic_issue_moved_from_project_monthly.yml)
Group: `group::product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_epic_issue_moved_from_project_weekly`
Counts of WAU moving epic issues between projects
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210405185814_g_project_management_epic_issue_moved_from_project_weekly.yml)
Group: `group::product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_epic_issue_removed_monthly` ### `redis_hll_counters.epics_usage.g_project_management_epic_issue_removed_monthly`
Count of MAU removing issues from epics Count of MAU removing issues from epics
......
...@@ -9,6 +9,7 @@ module EE ...@@ -9,6 +9,7 @@ module EE
def update_old_entity def update_old_entity
rewrite_epic_issue rewrite_epic_issue
rewrite_related_vulnerability_issues rewrite_related_vulnerability_issues
track_epic_issue_moved_from_project
super super
end end
...@@ -25,6 +26,12 @@ module EE ...@@ -25,6 +26,12 @@ module EE
original_entity.reset original_entity.reset
end end
def track_epic_issue_moved_from_project
return unless original_entity.epic_issue
::Gitlab::UsageDataCounters::EpicActivityUniqueCounter.track_epic_issue_moved_from_project(author: current_user)
end
def rewrite_related_vulnerability_issues def rewrite_related_vulnerability_issues
issue_links = Vulnerabilities::IssueLink.for_issue(original_entity) issue_links = Vulnerabilities::IssueLink.for_issue(original_entity)
issue_links.update_all(issue_id: new_entity.id) issue_links.update_all(issue_id: new_entity.id)
......
---
title: Track epic issues moved between projects
merge_request: 58590
author:
type: other
---
# Name of this metric contains g_project_management prefix
# because we are using the same slot from issue_tracking to
# allow data aggregation.
key_path: redis_hll_counters.epics_usage.g_project_management_epic_issue_moved_from_project_monthly
description: Counts of MAU moving epic issues between projects
product_section: dev
product_stage: plan
product_group: group::product planning
product_category: epics_usage
value_type: number
status: implemented
milestone: "13.11"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/58590
time_frame: 28d
data_source: redis_hll
distribution:
- ee
tier:
- premium
- ultimate
---
# Name of this metric contains g_project_management prefix
# because we are using the same slot from issue_tracking to
# allow data aggregation.
key_path: redis_hll_counters.epics_usage.g_project_management_epic_issue_moved_from_project_weekly
description: Counts of WAU moving epic issues between projects
product_section: dev
product_stage: plan
product_group: group::product planning
product_category: epics_usage
value_type: number
status: implemented
milestone: "13.11"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/58590
time_frame: 7d
data_source: redis_hll
distribution:
- ee
tier:
- premium
- ultimate
...@@ -21,6 +21,7 @@ module Gitlab ...@@ -21,6 +21,7 @@ module Gitlab
EPIC_FIXED_DUE_DATE_UPDATED = 'g_project_management_users_updating_fixed_epic_due_date' EPIC_FIXED_DUE_DATE_UPDATED = 'g_project_management_users_updating_fixed_epic_due_date'
EPIC_ISSUE_ADDED = 'g_project_management_epic_issue_added' EPIC_ISSUE_ADDED = 'g_project_management_epic_issue_added'
EPIC_ISSUE_REMOVED = 'g_project_management_epic_issue_removed' EPIC_ISSUE_REMOVED = 'g_project_management_epic_issue_removed'
EPIC_ISSUE_MOVED_FROM_PROJECT = 'g_project_management_epic_issue_moved_from_project'
EPIC_CLOSED = 'g_project_management_epic_closed' EPIC_CLOSED = 'g_project_management_epic_closed'
EPIC_REOPENED = 'g_project_management_epic_reopened' EPIC_REOPENED = 'g_project_management_epic_reopened'
ISSUE_PROMOTED_TO_EPIC = 'g_project_management_issue_promoted_to_epic' ISSUE_PROMOTED_TO_EPIC = 'g_project_management_issue_promoted_to_epic'
...@@ -85,6 +86,10 @@ module Gitlab ...@@ -85,6 +86,10 @@ module Gitlab
track_unique_action(EPIC_ISSUE_REMOVED, author) track_unique_action(EPIC_ISSUE_REMOVED, author)
end end
def track_epic_issue_moved_from_project(author:)
track_unique_action(EPIC_ISSUE_MOVED_FROM_PROJECT, author)
end
def track_epic_closed_action(author:) def track_epic_closed_action(author:)
track_unique_action(EPIC_CLOSED, author) track_unique_action(EPIC_CLOSED, author)
end end
......
...@@ -234,6 +234,18 @@ RSpec.describe Gitlab::UsageDataCounters::EpicActivityUniqueCounter, :clean_gitl ...@@ -234,6 +234,18 @@ RSpec.describe Gitlab::UsageDataCounters::EpicActivityUniqueCounter, :clean_gitl
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
end end
context 'for moving an issue that belongs to epic' do
def track_action(params)
described_class.track_epic_issue_moved_from_project(**params)
end
it_behaves_like 'a daily tracked issuable event' do
let(:action) { described_class::EPIC_ISSUE_MOVED_FROM_PROJECT }
end
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
end
context 'for promoting issue to epic' do context 'for promoting issue to epic' do
def track_action(params) def track_action(params)
described_class.track_issue_promoted_to_epic(**params) described_class.track_issue_promoted_to_epic(**params)
......
...@@ -29,6 +29,23 @@ RSpec.describe Issues::MoveService do ...@@ -29,6 +29,23 @@ RSpec.describe Issues::MoveService do
expect { move_service.execute(old_issue, new_project) } expect { move_service.execute(old_issue, new_project) }
.not_to raise_error # Sidekiq::Worker::EnqueueFromTransactionError .not_to raise_error # Sidekiq::Worker::EnqueueFromTransactionError
end end
context 'when moved issue belongs to epic' do
it 'records epic moved from project event' do
create(:epic_issue, issue: old_issue)
expect(Gitlab::UsageDataCounters::EpicActivityUniqueCounter).to receive(:track_epic_issue_moved_from_project).with(author: user)
move_service.execute(old_issue, new_project)
end
end
context 'when moved issue does not belong to epic' do
it 'does not record epic moved from project event' do
expect(Gitlab::UsageDataCounters::EpicActivityUniqueCounter).not_to receive(:track_epic_issue_moved_from_project)
move_service.execute(old_issue, new_project)
end
end
end end
context 'resource weight events' do context 'resource weight events' do
......
...@@ -93,6 +93,12 @@ ...@@ -93,6 +93,12 @@
aggregation: daily aggregation: daily
feature_flag: track_epics_activity feature_flag: track_epics_activity
- name: g_project_management_epic_issue_moved_from_project
category: epics_usage
redis_slot: project_management
aggregation: daily
feature_flag: track_epics_activity
- name: g_project_management_epic_closed - name: g_project_management_epic_closed
category: epics_usage category: epics_usage
redis_slot: project_management redis_slot: project_management
......
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