Commit 34e92fcf authored by Mikołaj Wawrzyniak's avatar Mikołaj Wawrzyniak

Merge branch '292253-cablett-track-epic-date-changed' into 'master'

Track epic fixed dates manually updated

See merge request gitlab-org/gitlab!57672
parents e84afea9 ad914d61
......@@ -10124,6 +10124,54 @@ Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_updating_fixed_epic_due_date_monthly`
Counts of MAU manually updating fixed due date
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_28d/20210329043548_g_project_management_users_updating_fixed_epic_due_date_monthly.yml)
Group: `group::product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_updating_fixed_epic_due_date_weekly`
Counts of WAU manually updating fixed due date
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210329042536_g_project_management_users_updating_fixed_epic_due_date_weekly.yml)
Group: `group::product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_updating_fixed_epic_start_date_monthly`
Counts of MAU manually updating fixed start date
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_28d/20210329043509_g_project_management_users_updating_fixed_epic_start_date_monthly.yml)
Group: `group::product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_updating_fixed_epic_start_date_weekly`
Counts of WAU manually updating fixed start date
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210329043402_g_project_management_users_updating_fixed_epic_start_date_weekly.yml)
Group: `group::product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.ide_edit.g_edit_by_sfe_monthly`
Missing description
......
......@@ -23,6 +23,7 @@ module Epics
track_start_date_fixed_events(epic)
track_due_date_fixed_events(epic)
track_fixed_dates_updated_events(epic)
epic.reset
end
......@@ -59,8 +60,22 @@ module Epics
private
def track_fixed_dates_updated_events(epic)
fixed_start_date_updated = epic.saved_change_to_attribute?(:start_date_fixed)
fixed_due_date_updated = epic.saved_change_to_attribute?(:due_date_fixed)
return unless fixed_start_date_updated || fixed_due_date_updated
if fixed_start_date_updated
::Gitlab::UsageDataCounters::EpicActivityUniqueCounter.track_epic_fixed_start_date_updated_action(author: current_user)
end
if fixed_due_date_updated
::Gitlab::UsageDataCounters::EpicActivityUniqueCounter.track_epic_fixed_due_date_updated_action(author: current_user)
end
end
def track_start_date_fixed_events(epic)
return unless epic.saved_changes.key?('start_date_is_fixed')
return unless epic.saved_change_to_attribute?(:start_date_is_fixed)
if epic.start_date_is_fixed?
::Gitlab::UsageDataCounters::EpicActivityUniqueCounter.track_epic_start_date_set_as_fixed_action(author: current_user)
......@@ -70,7 +85,7 @@ module Epics
end
def track_due_date_fixed_events(epic)
return unless epic.saved_changes.key?('due_date_is_fixed')
return unless epic.saved_change_to_attribute?(:due_date_is_fixed)
if epic.due_date_is_fixed?
::Gitlab::UsageDataCounters::EpicActivityUniqueCounter.track_epic_due_date_set_as_fixed_action(author: current_user)
......@@ -105,11 +120,11 @@ module Epics
end
def track_changes(epic)
if epic.saved_changes.key?('title')
if epic.saved_change_to_attribute?(:title)
::Gitlab::UsageDataCounters::EpicActivityUniqueCounter.track_epic_title_changed_action(author: current_user)
end
if epic.saved_changes.key?('description')
if epic.saved_change_to_attribute?(:description)
::Gitlab::UsageDataCounters::EpicActivityUniqueCounter.track_epic_description_changed_action(author: current_user)
end
end
......
---
title: Track epic change to fixed start/due dates via usage ping
merge_request: 57672
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_updating_fixed_epic_start_date_monthly
description: Counts of MAU manually updating fixed start date
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/57672
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_updating_fixed_epic_due_date_monthly
description: Counts of MAU manually updating fixed due date
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/57672
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_updating_fixed_epic_due_date_weekly
description: Counts of WAU manually updating fixed due date
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/57672
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_updating_fixed_epic_start_date_weekly
description: Counts of WAU manually updating fixed start date
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/57672
time_frame: 7d
data_source: redis_hll
distribution:
- ee
tier:
- premium
- ultimate
......@@ -17,6 +17,8 @@ module Gitlab
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_FIXED_START_DATE_UPDATED = 'g_project_management_users_updating_fixed_epic_start_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_CLOSED = 'g_project_management_epic_closed'
EPIC_REOPENED = 'g_project_management_epic_reopened'
......@@ -62,6 +64,14 @@ module Gitlab
track_unique_action(EPIC_DUE_DATE_SET_AS_INHERITED, author)
end
def track_epic_fixed_start_date_updated_action(author:)
track_unique_action(EPIC_FIXED_START_DATE_UPDATED, author)
end
def track_epic_fixed_due_date_updated_action(author:)
track_unique_action(EPIC_FIXED_DUE_DATE_UPDATED, author)
end
def track_epic_issue_added(author:)
track_unique_action(EPIC_ISSUE_ADDED, author)
end
......
......@@ -112,6 +112,18 @@ RSpec.describe Gitlab::UsageDataCounters::EpicActivityUniqueCounter, :clean_gitl
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
end
context 'setting as fixed start date event' do
def track_action(params)
described_class.track_epic_fixed_start_date_updated_action(**params)
end
it_behaves_like 'a daily tracked issuable event' do
let(:action) { described_class::EPIC_FIXED_START_DATE_UPDATED }
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)
......@@ -138,6 +150,18 @@ RSpec.describe Gitlab::UsageDataCounters::EpicActivityUniqueCounter, :clean_gitl
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
end
context 'setting as fixed due date event' do
def track_action(params)
described_class.track_epic_fixed_due_date_updated_action(**params)
end
it_behaves_like 'a daily tracked issuable event' do
let(:action) { described_class::EPIC_FIXED_DUE_DATE_UPDATED }
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_due_date_set_as_inherited_action(**params)
......
......@@ -348,6 +348,7 @@ RSpec.describe Epics::UpdateService do
context 'epic start date fixed or inherited' do
it 'tracks the user action to set as fixed' do
expect(::Gitlab::UsageDataCounters::EpicActivityUniqueCounter).to receive(:track_epic_start_date_set_as_fixed_action)
expect(::Gitlab::UsageDataCounters::EpicActivityUniqueCounter).to receive(:track_epic_fixed_start_date_updated_action)
update_epic(start_date_is_fixed: true, start_date_fixed: Date.today)
end
......@@ -362,6 +363,7 @@ RSpec.describe Epics::UpdateService do
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)
expect(::Gitlab::UsageDataCounters::EpicActivityUniqueCounter).to receive(:track_epic_fixed_due_date_updated_action)
update_epic(due_date_is_fixed: true, due_date_fixed: Date.today)
end
......
......@@ -21,6 +21,8 @@
aggregation: daily
feature_flag: track_epics_activity
# epic notes
- name: g_project_management_users_creating_epic_notes
category: epics_usage
redis_slot: project_management
......@@ -39,24 +41,40 @@
aggregation: daily
feature_flag: track_epics_activity
# start date events
- name: g_project_management_users_setting_epic_start_date_as_fixed
category: epics_usage
redis_slot: project_management
aggregation: daily
feature_flag: track_epics_activity
- name: g_project_management_users_updating_fixed_epic_start_date
category: epics_usage
redis_slot: project_management
aggregation: daily
feature_flag: track_epics_activity
- name: g_project_management_users_setting_epic_start_date_as_inherited
category: epics_usage
redis_slot: project_management
aggregation: daily
feature_flag: track_epics_activity
# due date events
- 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_updating_fixed_epic_due_date
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
......
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