Commit a2cdfb88 authored by Jarka Košanová's avatar Jarka Košanová

Merge branch '292253-cablett-track-epic-title-description-changes' into 'master'

Track epic title and description changes via usage ping

See merge request gitlab-org/gitlab!56489
parents 1f5b2b9d 6ba21d8c
......@@ -10004,6 +10004,30 @@ Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_updating_epic_descriptions_monthly`
Counts of MAU changing epic descriptions
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_28d/20210312102051_g_project_management_users_updating_epic_descriptions_monthly.yml)
Group: `group:product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_updating_epic_descriptions_weekly`
Counts of WAU changing epic descriptions
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210312101753_g_project_management_users_updating_epic_descriptions_weekly.yml)
Group: `group:product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_updating_epic_notes_monthly`
Counts of MAU updating epic notes
......@@ -10028,6 +10052,30 @@ Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_updating_epic_titles_monthly`
Counts of MAU changing epic titles
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_28d/20210312101935_g_project_management_users_updating_epic_titles_monthly.yml)
Group: `group:product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_updating_epic_titles_weekly`
Counts of WAU changing epic titles
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210312101826_g_project_management_users_updating_epic_titles_weekly.yml)
Group: `group:product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.ide_edit.g_edit_by_sfe_monthly`
Missing description
......
......@@ -26,6 +26,8 @@ module Epics
epic.reset
end
track_changes(epic)
assign_parent_epic_for(epic)
assign_child_epic_for(epic)
......@@ -90,5 +92,15 @@ module Epics
def saved_change_to_epic_dates?(epic)
(epic.saved_changes.keys.map(&:to_sym) & EPIC_DATE_FIELDS).present?
end
def track_changes(epic)
if epic.saved_changes.key?('title')
::Gitlab::UsageDataCounters::EpicActivityUniqueCounter.track_epic_title_changed_action(author: current_user)
end
if epic.saved_changes.key?('description')
::Gitlab::UsageDataCounters::EpicActivityUniqueCounter.track_epic_description_changed_action(author: current_user)
end
end
end
end
---
title: Track epic title and description changes via usage ping
merge_request: 56489
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_epic_titles_monthly
description: Counts of MAU changing epic titles
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/56489
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_epic_descriptions_monthly
description: Counts of MAU changing epic descriptions
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/56489
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_epic_descriptions_weekly
description: Counts of WAU changing epic descriptions
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/56489
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_epic_titles_weekly
description: Counts of WAU changing epic titles
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/56489
time_frame: 7d
data_source: redis_hll
distribution:
- ee
tier:
- premium
- ultimate
......@@ -8,6 +8,8 @@ module Gitlab
# slot of issue events to allow data aggregation.
# More information in: https://gitlab.com/gitlab-org/gitlab/-/issues/322405
EPIC_CREATED = 'g_project_management_epic_created'
EPIC_TITLE_CHANGED = 'g_project_management_users_updating_epic_titles'
EPIC_DESCRIPTION_CHANGED = 'g_project_management_users_updating_epic_descriptions'
EPIC_NOTE_CREATED = 'g_project_management_users_creating_epic_notes'
EPIC_NOTE_UPDATED = 'g_project_management_users_updating_epic_notes'
EPIC_NOTE_DESTROYED = 'g_project_management_users_destroying_epic_notes'
......@@ -22,6 +24,14 @@ module Gitlab
track_unique_action(EPIC_CREATED, author, time)
end
def track_epic_title_changed_action(author:, time: Time.zone.now)
track_unique_action(EPIC_TITLE_CHANGED, author, time)
end
def track_epic_description_changed_action(author:, time: Time.zone.now)
track_unique_action(EPIC_DESCRIPTION_CHANGED, author, time)
end
def track_epic_note_created_action(author:, time: Time.zone.now)
track_unique_action(EPIC_NOTE_CREATED, author, time)
end
......
......@@ -20,6 +20,30 @@ RSpec.describe Gitlab::UsageDataCounters::EpicActivityUniqueCounter, :clean_gitl
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
end
context 'for epic title changed event' do
def track_action(params)
described_class.track_epic_title_changed_action(**params)
end
it_behaves_like 'a daily tracked issuable event' do
let(:action) { described_class::EPIC_TITLE_CHANGED }
end
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
end
context 'for epic description changed event' do
def track_action(params)
described_class.track_epic_description_changed_action(**params)
end
it_behaves_like 'a daily tracked issuable event' do
let(:action) { described_class::EPIC_DESCRIPTION_CHANGED }
end
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
end
context 'for epic note created event' do
def track_action(params)
described_class.track_epic_note_created_action(**params)
......
......@@ -71,6 +71,12 @@ RSpec.describe Epics::UpdateService do
expect(note.note).to start_with('changed title')
expect(note.noteable).to eq(epic)
end
it 'records epic title changed after saving' do
expect(::Gitlab::UsageDataCounters::EpicActivityUniqueCounter).to receive(:track_epic_title_changed_action)
update_epic(title: 'New title')
end
end
context 'when description has changed' do
......@@ -82,6 +88,12 @@ RSpec.describe Epics::UpdateService do
expect(note.note).to start_with('changed the description')
expect(note.noteable).to eq(epic)
end
it 'records epic description changed after saving' do
expect(::Gitlab::UsageDataCounters::EpicActivityUniqueCounter).to receive(:track_epic_description_changed_action)
update_epic(description: 'New description')
end
end
context 'when repositioning an epic on a board' do
......
......@@ -9,6 +9,18 @@
aggregation: daily
feature_flag: track_epics_activity
- name: g_project_management_users_updating_epic_titles
category: epics_usage
redis_slot: project_management
aggregation: daily
feature_flag: track_epics_activity
- name: g_project_management_users_updating_epic_descriptions
category: epics_usage
redis_slot: project_management
aggregation: daily
feature_flag: track_epics_activity
- name: g_project_management_users_creating_epic_notes
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