Commit 0673d411 authored by charlie ablett's avatar charlie ablett

Merge branch '292253-cablett-epic-fixed-due-date' into 'master'

Track epic due date as fixed/inherited via usage ping

See merge request gitlab-org/gitlab!57457
parents 73c61ec1 f5c23403
......@@ -9956,6 +9956,54 @@ Status: `implemented`
Tiers: `premium`, `ultimate`
### `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
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_28d/20210325060507_g_project_management_users_setting_epic_due_date_as_fixed_monthly.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_weekly`
Counts of WAU setting epic due date as fixed
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210325060623_g_project_management_users_setting_epic_due_date_as_fixed_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_inherited_monthly`
Counts of MAU setting epic due date as inherited
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_28d/20210325060315_g_project_management_users_setting_epic_due_date_as_inherited_monthly.yml)
Group: `group::product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_setting_epic_due_date_as_inherited_weekly`
Counts of WAU setting epic due date as inherited
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210325060903_g_project_management_users_setting_epic_due_date_as_inherited_weekly.yml)
Group: `group::product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_setting_epic_start_date_as_fixed_monthly`
Counts of MAU setting epic start date as fixed
......
......@@ -22,6 +22,7 @@ module Epics
Epics::UpdateDatesService.new([epic]).execute
track_start_date_fixed_events(epic)
track_due_date_fixed_events(epic)
epic.reset
end
......@@ -68,6 +69,16 @@ module Epics
end
end
def track_due_date_fixed_events(epic)
return unless epic.saved_changes.key?('due_date_is_fixed')
if epic.due_date_is_fixed?
::Gitlab::UsageDataCounters::EpicActivityUniqueCounter.track_epic_due_date_set_as_fixed_action(author: current_user)
else
::Gitlab::UsageDataCounters::EpicActivityUniqueCounter.track_epic_due_date_set_as_inherited_action(author: current_user)
end
end
def reposition_on_board(epic)
return unless params[:move_between_ids]
return unless params[positioning_scope_key]
......
---
title: Track epic due date set to fixed or inherited via usage ping
merge_request: 57457
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_due_date_as_inherited_monthly
description: Counts of MAU setting epic due date as inherited
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/57457
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_due_date_as_fixed_monthly
description: Counts of MAU setting epic due date as inherited
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/57457
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_due_date_as_fixed_weekly
description: Counts of WAU setting epic due date as fixed
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/57457
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_due_date_as_inherited_weekly
description: Counts of WAU setting epic due date as inherited
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/57457
time_frame: 7d
data_source: redis_hll
distribution:
- ee
tier:
- premium
- ultimate
......@@ -15,6 +15,8 @@ module Gitlab
EPIC_NOTE_DESTROYED = 'g_project_management_users_destroying_epic_notes'
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_DUE_DATE_SET_AS_FIXED = 'g_project_management_users_setting_epic_due_date_as_fixed'
EPIC_DUE_DATE_SET_AS_INHERITED = 'g_project_management_users_setting_epic_due_date_as_inherited'
EPIC_ISSUE_ADDED = 'g_project_management_epic_issue_added'
EPIC_CLOSED = 'g_project_management_epic_closed'
EPIC_REOPENED = 'g_project_management_epic_reopened'
......@@ -52,6 +54,14 @@ module Gitlab
track_unique_action(EPIC_START_DATE_SET_AS_INHERITED, author, time)
end
def track_epic_due_date_set_as_fixed_action(author:, time: Time.zone.now)
track_unique_action(EPIC_DUE_DATE_SET_AS_FIXED, author, time)
end
def track_epic_due_date_set_as_inherited_action(author:, time: Time.zone.now)
track_unique_action(EPIC_DUE_DATE_SET_AS_INHERITED, author, time)
end
def track_epic_issue_added(author:, time: Time.zone.now)
track_unique_action(EPIC_ISSUE_ADDED, author, time)
end
......
......@@ -101,28 +101,56 @@ RSpec.describe Gitlab::UsageDataCounters::EpicActivityUniqueCounter, :clean_gitl
end
context 'for epic date modification events' do
context 'setting start date as fixed event' do
def track_action(params)
described_class.track_epic_start_date_set_as_fixed_action(**params)
end
context 'start date' do
context 'setting as fixed event' do
def track_action(params)
described_class.track_epic_start_date_set_as_fixed_action(**params)
end
it_behaves_like 'a daily tracked issuable event' do
let(:action) { described_class::EPIC_START_DATE_SET_AS_FIXED }
end
it_behaves_like 'a daily tracked issuable event' do
let(:action) { described_class::EPIC_START_DATE_SET_AS_FIXED }
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
end
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
end
context 'setting as inherited event' do
def track_action(params)
described_class.track_epic_start_date_set_as_inherited_action(**params)
end
context 'setting start date as inherited event' do
def track_action(params)
described_class.track_epic_start_date_set_as_inherited_action(**params)
it_behaves_like 'a daily tracked issuable event' do
let(:action) { described_class::EPIC_START_DATE_SET_AS_INHERITED }
end
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
end
end
it_behaves_like 'a daily tracked issuable event' do
let(:action) { described_class::EPIC_START_DATE_SET_AS_INHERITED }
context 'due date' do
context 'setting as fixed event' do
def track_action(params)
described_class.track_epic_due_date_set_as_fixed_action(**params)
end
it_behaves_like 'a daily tracked issuable event' do
let(:action) { described_class::EPIC_DUE_DATE_SET_AS_FIXED }
end
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
end
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
context 'setting as inherited event' do
def track_action(params)
described_class.track_epic_due_date_set_as_inherited_action(**params)
end
it_behaves_like 'a daily tracked issuable event' do
let(:action) { described_class::EPIC_DUE_DATE_SET_AS_INHERITED }
end
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
end
end
end
......
......@@ -359,6 +359,20 @@ RSpec.describe Epics::UpdateService do
end
end
context 'epic due date fixed or inherited' do
it 'tracks the user action to set as fixed' do
expect(::Gitlab::UsageDataCounters::EpicActivityUniqueCounter).to receive(:track_epic_due_date_set_as_fixed_action)
update_epic(due_date_is_fixed: true, due_date_fixed: Date.today)
end
it 'tracks the user action to set as inherited' do
expect(::Gitlab::UsageDataCounters::EpicActivityUniqueCounter).to receive(:track_epic_due_date_set_as_inherited_action)
update_epic(due_date_is_fixed: false)
end
end
context 'date fields are not updated' do
it 'does not call UpdateDatesService' do
expect(Epics::UpdateDatesService).not_to receive(:new)
......
......@@ -51,6 +51,18 @@
aggregation: daily
feature_flag: track_epics_activity
- name: g_project_management_users_setting_epic_due_date_as_fixed
category: epics_usage
redis_slot: project_management
aggregation: daily
feature_flag: track_epics_activity
- name: g_project_management_users_setting_epic_due_date_as_inherited
category: epics_usage
redis_slot: project_management
aggregation: daily
feature_flag: track_epics_activity
- name: g_project_management_epic_issue_added
category: epics_usage
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