Commit eb999a05 authored by David Fernandez's avatar David Fernandez

Merge branch '292253-counts-epic-status-change' into 'master'

Track closing and reopening events

See merge request gitlab-org/gitlab!56246
parents 37e2e615 445cf696
...@@ -9812,6 +9812,30 @@ Status: `implemented` ...@@ -9812,6 +9812,30 @@ Status: `implemented`
Tiers: `premium`, `ultimate` Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_epic_closed_monthly`
Counts of MAU closing epics
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_28d/20210310163213_g_project_management_epic_closed_monthly.yml)
Group: `group::product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_epic_closed_weekly`
Counts of WAU closing epics
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210310162703_g_project_management_epic_closed_weekly.yml)
Group: `group::product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_epic_created_monthly` ### `redis_hll_counters.epics_usage.g_project_management_epic_created_monthly`
Count of MAU creating epics Count of MAU creating epics
...@@ -9860,6 +9884,30 @@ Status: `implemented` ...@@ -9860,6 +9884,30 @@ Status: `implemented`
Tiers: `premium`, `ultimate` Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_epic_reopened_monthly`
Counts of MAU closing epics
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_28d/20210310164247_g_project_management_epic_reopened_monthly.yml)
Group: `group::product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_epic_reopened_weekly`
Counts of WAU re-opening epics
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210310164112_g_project_management_epic_reopened_weekly.yml)
Group: `group::product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_destroying_epic_notes_monthly` ### `redis_hll_counters.epics_usage.g_project_management_users_destroying_epic_notes_monthly`
Counts of MAU destroying epic notes Counts of MAU destroying epic notes
......
...@@ -16,6 +16,7 @@ module Epics ...@@ -16,6 +16,7 @@ module Epics
event_service.close_epic(epic, current_user) event_service.close_epic(epic, current_user)
SystemNoteService.change_status(epic, nil, current_user, epic.state) SystemNoteService.change_status(epic, nil, current_user, epic.state)
notification_service.close_epic(epic, current_user) notification_service.close_epic(epic, current_user)
::Gitlab::UsageDataCounters::EpicActivityUniqueCounter.track_epic_closed_action(author: current_user)
end end
end end
end end
......
...@@ -15,6 +15,7 @@ module Epics ...@@ -15,6 +15,7 @@ module Epics
event_service.reopen_epic(epic, current_user) event_service.reopen_epic(epic, current_user)
SystemNoteService.change_status(epic, nil, current_user, epic.state) SystemNoteService.change_status(epic, nil, current_user, epic.state)
notification_service.reopen_epic(epic, current_user) notification_service.reopen_epic(epic, current_user)
::Gitlab::UsageDataCounters::EpicActivityUniqueCounter.track_epic_reopened_action(author: current_user)
end end
end end
end end
......
---
title: Track epic status change action on usage ping
merge_request: 56246
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_closed_monthly
description: Counts of MAU closing epics
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_epic_reopened_monthly
description: Counts of MAU closing epics
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_epic_closed_weekly
description: Counts of WAU closing epics
product_section: dev
product_stage: plan
product_group: group::product planning
product_category: epics_usage
value_type: number
status: implemented
milestone: "13.10"
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_epic_reopened_weekly
description: Counts of WAU re-opening epics
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
...@@ -13,6 +13,8 @@ module Gitlab ...@@ -13,6 +13,8 @@ module Gitlab
EPIC_START_DATE_SET_AS_FIXED = 'g_project_management_users_setting_epic_start_date_as_fixed' EPIC_START_DATE_SET_AS_FIXED = 'g_project_management_users_setting_epic_start_date_as_fixed'
EPIC_START_DATE_SET_AS_INHERITED = 'g_project_management_users_setting_epic_start_date_as_inherited' EPIC_START_DATE_SET_AS_INHERITED = 'g_project_management_users_setting_epic_start_date_as_inherited'
EPIC_ISSUE_ADDED = 'g_project_management_epic_issue_added' EPIC_ISSUE_ADDED = 'g_project_management_epic_issue_added'
EPIC_CLOSED = 'g_project_management_epic_closed'
EPIC_REOPENED = 'g_project_management_epic_reopened'
class << self class << self
def track_epic_created_action(author:, time: Time.zone.now) def track_epic_created_action(author:, time: Time.zone.now)
...@@ -39,6 +41,14 @@ module Gitlab ...@@ -39,6 +41,14 @@ module Gitlab
track_unique_action(EPIC_ISSUE_ADDED, author, time) track_unique_action(EPIC_ISSUE_ADDED, author, time)
end end
def track_epic_closed_action(author:, time: Time.zone.now)
track_unique_action(EPIC_CLOSED, author, time)
end
def track_epic_reopened_action(author:, time: Time.zone.now)
track_unique_action(EPIC_REOPENED, author, time)
end
private private
def track_unique_action(action, author, time) def track_unique_action(action, author, time)
......
...@@ -28,8 +28,6 @@ RSpec.describe Gitlab::UsageDataCounters::EpicActivityUniqueCounter, :clean_gitl ...@@ -28,8 +28,6 @@ RSpec.describe Gitlab::UsageDataCounters::EpicActivityUniqueCounter, :clean_gitl
it_behaves_like 'a daily tracked issuable event' do it_behaves_like 'a daily tracked issuable event' do
let(:action) { described_class::EPIC_NOTE_UPDATED } let(:action) { described_class::EPIC_NOTE_UPDATED }
end end
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
end end
context 'for epic note destroyed event' do context 'for epic note destroyed event' do
...@@ -40,6 +38,28 @@ RSpec.describe Gitlab::UsageDataCounters::EpicActivityUniqueCounter, :clean_gitl ...@@ -40,6 +38,28 @@ RSpec.describe Gitlab::UsageDataCounters::EpicActivityUniqueCounter, :clean_gitl
it_behaves_like 'a daily tracked issuable event' do it_behaves_like 'a daily tracked issuable event' do
let(:action) { described_class::EPIC_NOTE_DESTROYED } let(:action) { described_class::EPIC_NOTE_DESTROYED }
end end
end
context 'for epic closing event' do
def track_action(params)
described_class.track_epic_closed_action(**params)
end
it_behaves_like 'a daily tracked issuable event' do
let(:action) { described_class::EPIC_CLOSED }
end
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
end
context 'for epic reopening event' do
def track_action(params)
described_class.track_epic_reopened_action(**params)
end
it_behaves_like 'a daily tracked issuable event' do
let(:action) { described_class::EPIC_REOPENED }
end
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
......
...@@ -59,9 +59,16 @@ RSpec.describe Epics::CloseService do ...@@ -59,9 +59,16 @@ RSpec.describe Epics::CloseService do
subject.execute(epic) subject.execute(epic)
end end
it "creates new event" do it 'creates new event' do
expect { subject.execute(epic) }.to change { Event.count } expect { subject.execute(epic) }.to change { Event.count }
end end
it 'tracks closing the epic' do
expect(::Gitlab::UsageDataCounters::EpicActivityUniqueCounter)
.to receive(:track_epic_closed_action).with(author: user)
subject.execute(epic)
end
end end
context 'when trying to close a closed epic' do context 'when trying to close a closed epic' do
...@@ -94,6 +101,12 @@ RSpec.describe Epics::CloseService do ...@@ -94,6 +101,12 @@ RSpec.describe Epics::CloseService do
it "does not create an event" do it "does not create an event" do
expect { subject.execute(epic) }.not_to change { Event.count } expect { subject.execute(epic) }.not_to change { Event.count }
end end
it 'does not track closing the epic' do
expect(::Gitlab::UsageDataCounters::EpicActivityUniqueCounter).not_to receive(:track_epic_closed_action)
subject.execute(epic)
end
end end
end end
......
...@@ -59,9 +59,16 @@ RSpec.describe Epics::ReopenService do ...@@ -59,9 +59,16 @@ RSpec.describe Epics::ReopenService do
subject.execute(epic) subject.execute(epic)
end end
it "creates new event" do it 'creates new event' do
expect { subject.execute(epic) }.to change { Event.count } expect { subject.execute(epic) }.to change { Event.count }
end end
it 'tracks reopening the epic' do
expect(::Gitlab::UsageDataCounters::EpicActivityUniqueCounter)
.to receive(:track_epic_reopened_action).with(author: user)
subject.execute(epic)
end
end end
context 'when trying to reopen an opened epic' do context 'when trying to reopen an opened epic' do
...@@ -91,9 +98,15 @@ RSpec.describe Epics::ReopenService do ...@@ -91,9 +98,15 @@ RSpec.describe Epics::ReopenService do
subject.execute(epic) subject.execute(epic)
end end
it "does not create an event" do it 'does not create an event' do
expect { subject.execute(epic) }.not_to change { Event.count } expect { subject.execute(epic) }.not_to change { Event.count }
end end
it 'does not track reopening the epic' do
expect(::Gitlab::UsageDataCounters::EpicActivityUniqueCounter).not_to receive(:track_epic_reopened_action)
subject.execute(epic)
end
end end
end end
......
...@@ -38,3 +38,15 @@ ...@@ -38,3 +38,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_epic_closed
category: epics_usage
redis_slot: project_management
aggregation: daily
feature_flag: track_epics_activity
- name: g_project_management_epic_reopened
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