Commit 5f3af62b authored by Jarka Košanová's avatar Jarka Košanová

Track making epics confidential/visible

- track 2 new events - epic becoming visible/confidential
- updatee the yml files and dictionary
- add specs
parent 8a31f66b
...@@ -10004,6 +10004,30 @@ Status: `implemented` ...@@ -10004,6 +10004,30 @@ Status: `implemented`
Tiers: `premium`, `ultimate` Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_setting_epic_confidential_monthly`
Count of MAU making epics confidential
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_28d/20210310203049_g_project_management_epic_confidential_monthly.yml)
Group: `group::product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_setting_epic_confidential_weekly`
Count of WAU making epics confidential
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210310203225_g_project_management_epic_confidential_weekly.yml)
Group: `group::product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_setting_epic_due_date_as_fixed_monthly` ### `redis_hll_counters.epics_usage.g_project_management_users_setting_epic_due_date_as_fixed_monthly`
Counts of MAU setting epic due date as inherited Counts of MAU setting epic due date as inherited
...@@ -10100,6 +10124,30 @@ Status: `implemented` ...@@ -10100,6 +10124,30 @@ Status: `implemented`
Tiers: `premium`, `ultimate` Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_setting_epic_visible_monthly`
Count of MAU making epics visible
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_28d/20210312093611_g_project_management_epic_visible_monthly.yml)
Group: `group::product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_setting_epic_visible_weekly`
Count of WAU making epics visible
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210312093243_g_poject_management_epic_visible_weekly.yml)
Group: `group::product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_updating_epic_descriptions_monthly` ### `redis_hll_counters.epics_usage.g_project_management_users_updating_epic_descriptions_monthly`
Counts of MAU changing epic descriptions Counts of MAU changing epic descriptions
......
...@@ -47,9 +47,18 @@ module Epics ...@@ -47,9 +47,18 @@ module Epics
todo_service.update_epic(epic, current_user, old_mentioned_users) todo_service.update_epic(epic, current_user, old_mentioned_users)
if epic.previous_changes.include?('confidential') && epic.confidential? if epic.saved_change_to_attribute?(:confidential)
handle_confidentiality_change(epic)
end
end
def handle_confidentiality_change(epic)
if epic.confidential?
::Gitlab::UsageDataCounters::EpicActivityUniqueCounter.track_epic_confidential_action(author: current_user)
# don't enqueue immediately to prevent todos removal in case of a mistake # don't enqueue immediately to prevent todos removal in case of a mistake
::TodosDestroyer::ConfidentialEpicWorker.perform_in(::Todo::WAIT_FOR_DELETE, epic.id) ::TodosDestroyer::ConfidentialEpicWorker.perform_in(::Todo::WAIT_FOR_DELETE, epic.id)
else
::Gitlab::UsageDataCounters::EpicActivityUniqueCounter.track_epic_visible_action(author: current_user)
end end
end end
......
---
title: Track epic confidentiality change action on usage ping
merge_request: 56483
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_users_setting_epic_confidential_monthly
description: Count of MAU making epics confidential
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/56246
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_users_setting_epic_visible_monthly
description: Count of MAU making epics visible
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/56246
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_users_setting_epic_confidential_weekly
description: Count of WAU making epics confidential
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/56246
time_frame: 7d
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_users_setting_epic_visible_weekly
description: Count of WAU making epics visible
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/56246
time_frame: 7d
data_source: redis_hll
distribution:
- ee
tier:
- premium
- ultimate
...@@ -23,6 +23,8 @@ module Gitlab ...@@ -23,6 +23,8 @@ module Gitlab
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'
EPIC_CONFIDENTIAL = 'g_project_management_users_setting_epic_confidential'
EPIC_VISIBLE = 'g_project_management_users_setting_epic_visible'
class << self class << self
def track_epic_created_action(author:) def track_epic_created_action(author:)
...@@ -89,6 +91,14 @@ module Gitlab ...@@ -89,6 +91,14 @@ module Gitlab
track_unique_action(ISSUE_PROMOTED_TO_EPIC, author) track_unique_action(ISSUE_PROMOTED_TO_EPIC, author)
end end
def track_epic_confidential_action(author:)
track_unique_action(EPIC_CONFIDENTIAL, author)
end
def track_epic_visible_action(author:)
track_unique_action(EPIC_VISIBLE, author)
end
private private
def track_unique_action(action, author) def track_unique_action(action, author)
......
...@@ -98,6 +98,30 @@ RSpec.describe Gitlab::UsageDataCounters::EpicActivityUniqueCounter, :clean_gitl ...@@ -98,6 +98,30 @@ 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 making epic visible' do
def track_action(params)
described_class.track_epic_visible_action(**params)
end
it_behaves_like 'a daily tracked issuable event' do
let(:action) { described_class::EPIC_VISIBLE }
end
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
end
context 'for making epic confidential' do
def track_action(params)
described_class.track_epic_confidential_action(**params)
end
it_behaves_like 'a daily tracked issuable event' do
let(:action) { described_class::EPIC_CONFIDENTIAL }
end
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
end
context 'for epic date modification events' do context 'for epic date modification events' do
context 'start date' do context 'start date' do
context 'setting as fixed event' do context 'setting as fixed event' do
......
...@@ -269,11 +269,39 @@ RSpec.describe Epics::UpdateService do ...@@ -269,11 +269,39 @@ RSpec.describe Epics::UpdateService do
end end
end end
it 'schedules deletion of todos when epic becomes confidential' do context 'when the epic becomes confidential' do
it 'schedules deletion of todos' do
expect(TodosDestroyer::ConfidentialEpicWorker).to receive(:perform_in).with(Todo::WAIT_FOR_DELETE, epic.id) expect(TodosDestroyer::ConfidentialEpicWorker).to receive(:perform_in).with(Todo::WAIT_FOR_DELETE, epic.id)
update_epic(confidential: true) update_epic(confidential: true)
end end
it 'tracks the epic becoming confidential' do
expect(::Gitlab::UsageDataCounters::EpicActivityUniqueCounter)
.to receive(:track_epic_confidential_action).with(author: user)
update_epic(confidential: true)
end
end
context 'when the epic becomes visible' do
before do
epic.update_column(:confidential, true)
end
it 'does not schedule deletion of todos' do
expect(TodosDestroyer::ConfidentialEpicWorker).not_to receive(:perform_in)
update_epic(confidential: false)
end
it 'tracks the epic becoming visible' do
expect(::Gitlab::UsageDataCounters::EpicActivityUniqueCounter)
.to receive(:track_epic_visible_action).with(author: user)
update_epic(confidential: false)
end
end
end end
context 'when Epic has tasks' do context 'when Epic has tasks' do
......
...@@ -104,3 +104,15 @@ ...@@ -104,3 +104,15 @@
redis_slot: project_management redis_slot: project_management
aggregation: daily aggregation: daily
feature_flag: track_epics_activity feature_flag: track_epics_activity
- name: g_project_management_users_setting_epic_confidential
category: epics_usage
redis_slot: project_management
aggregation: daily
feature_flag: track_epics_activity
- name: g_project_management_users_setting_epic_visible
category: epics_usage
redis_slot: project_management
aggregation: daily
feature_flag: track_epics_activity
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