Commit 9f1ca432 authored by Felipe Artur's avatar Felipe Artur

Track epic promoted action

Record issue promoted to epic on usage ping
Redis HLL
parent 8ef5a6d0
......@@ -9908,6 +9908,30 @@ Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_issue_promoted_to_epic_monthly`
Count of MAU promoting issues to epics
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_28d/20210331193236_g_project_management_issue_promoted_to_epic_monthly.yml)
Group: `group::product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_issue_promoted_to_epic_weekly`
Counts of WAU promoting issues to epics
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210331192332_g_project_management_issue_promoted_to_epic_weekly.yml)
Group: `group::product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_creating_epic_notes_monthly`
Counts of MAU adding epic notes
......
......@@ -34,6 +34,8 @@ module Epics
def track_event
::Gitlab::Tracking.event('epics', 'promote', property: 'issue_id', value: original_entity.id,
project: issue.project, user: current_user, namespace: @parent_group)
::Gitlab::UsageDataCounters::EpicActivityUniqueCounter.track_issue_promoted_to_epic(author: current_user)
end
def create_new_entity
......
---
# 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_issue_promoted_to_epic_monthly
description: Count of MAU promoting issues to 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/56706
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_issue_promoted_to_epic_weekly
description: Counts of WAU promoting issues to 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/56706
time_frame: 7d
data_source: redis_hll
distribution:
- ee
tier:
- premium
- ultimate
......@@ -22,6 +22,7 @@ module Gitlab
EPIC_ISSUE_ADDED = 'g_project_management_epic_issue_added'
EPIC_CLOSED = 'g_project_management_epic_closed'
EPIC_REOPENED = 'g_project_management_epic_reopened'
ISSUE_PROMOTED_TO_EPIC = 'g_project_management_issue_promoted_to_epic'
class << self
def track_epic_created_action(author:)
......@@ -84,6 +85,10 @@ module Gitlab
track_unique_action(EPIC_REOPENED, author)
end
def track_issue_promoted_to_epic(author:)
track_unique_action(ISSUE_PROMOTED_TO_EPIC, author)
end
private
def track_unique_action(action, author)
......
......@@ -187,4 +187,16 @@ RSpec.describe Gitlab::UsageDataCounters::EpicActivityUniqueCounter, :clean_gitl
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
end
context 'for promoting issue to epic' do
def track_action(params)
described_class.track_issue_promoted_to_epic(**params)
end
it_behaves_like 'a daily tracked issuable event' do
let(:action) { described_class::ISSUE_PROMOTED_TO_EPIC }
end
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
end
end
......@@ -57,6 +57,13 @@ RSpec.describe Epics::IssuePromoteService, :aggregate_failures do
end
end
it 'counts a usage ping event' do
expect(::Gitlab::UsageDataCounters::EpicActivityUniqueCounter).to receive(:track_issue_promoted_to_epic)
.with(author: user)
subject.execute(issue)
end
context 'when promoting issue', :snowplow do
let!(:issue_mentionable_note) { create(:note, noteable: issue, author: user, project: project, note: "note with mention #{user.to_reference}") }
let!(:issue_note) { create(:note, noteable: issue, author: user, project: project, note: "note without mention") }
......
......@@ -98,3 +98,9 @@
redis_slot: project_management
aggregation: daily
feature_flag: track_epics_activity
- name: 'g_project_management_issue_promoted_to_epic'
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