Commit bd807f0d authored by Thong Kuah's avatar Thong Kuah

Merge branch 'issue_355471-count_blocking_epics_on_usage_data' into 'master'

Track blocking epics added on usage data

See merge request gitlab-org/gitlab!84400
parents 8cf2f24c 275aa1c6
......@@ -46,6 +46,7 @@ options:
- g_project_management_users_epic_issue_added_from_epic
- g_project_management_epic_related_added
- g_project_management_epic_related_removed
- g_project_management_epic_blocking_added
distribution:
- ee
tier:
......
---
key_path: redis_hll_counters.epics_usage.g_project_management_epic_blocking_added_monthly
description: Count of MAU adding blocking epics
product_section: dev
product_stage: plan
product_group: group::product planning
product_category: epics_usage
value_type: number
status: active
milestone: "14.10"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/84400
time_frame: 28d
data_source: redis_hll
data_category: optional
instrumentation_class: RedisHLLMetric
options:
events:
- g_project_management_epic_blocking_added
distribution:
- ee
tier:
- ultimate
......@@ -46,6 +46,7 @@ options:
- g_project_management_users_epic_issue_added_from_epic
- g_project_management_epic_related_added
- g_project_management_epic_related_removed
- g_project_management_epic_blocking_added
distribution:
- ee
tier:
......
---
key_path: redis_hll_counters.epics_usage.g_project_management_epic_blocking_added_weekly
description: Count of WAU adding blocking epics
product_section: dev
product_stage: plan
product_group: group::product planning
product_category: epics_usage
value_type: number
status: active
milestone: "14.10"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/84400
time_frame: 7d
data_source: redis_hll
data_category: optional
instrumentation_class: RedisHLLMetric
options:
events:
- g_project_management_epic_blocking_added
distribution:
- ee
tier:
- ultimate
......@@ -37,6 +37,7 @@ module Gitlab
EPIC_CROSS_REFERENCED = 'g_project_management_epic_cross_referenced'
EPIC_RELATED_ADDED = 'g_project_management_epic_related_added'
EPIC_RELATED_REMOVED = 'g_project_management_epic_related_removed'
EPIC_BLOCKING_ADDED = 'g_project_management_epic_blocking_added'
class << self
def track_epic_created_action(author:)
......@@ -160,6 +161,7 @@ module Gitlab
end
def track_linked_epic_with_type_blocks_added(author:)
track_unique_action(EPIC_BLOCKING_ADDED, author)
end
def track_linked_epic_with_type_blocks_removed(author:)
......
......@@ -361,4 +361,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 blocking epic added' do
def track_action(params)
described_class.track_linked_epic_with_type_blocks_added(**params)
end
it_behaves_like 'a daily tracked issuable event' do
let(:action) { described_class::EPIC_BLOCKING_ADDED }
end
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
end
end
......@@ -54,18 +54,32 @@ RSpec.describe Epics::RelatedEpicLinks::CreateService do
end
context 'event tracking' do
context 'for relates_to link type' do
shared_examples 'a recorded event' do
it 'records event for each link created' do
params = {
link_type: IssuableLink::TYPE_RELATES_TO,
link_type: link_type,
issuable_references: [issuable_a, issuable3].map { |epic| epic.to_reference(issuable.group, full: true) }
}
expect(Gitlab::UsageDataCounters::EpicActivityUniqueCounter).to receive(:track_linked_epic_with_type_relates_to_added).with(author: user).twice
expect(Gitlab::UsageDataCounters::EpicActivityUniqueCounter).to receive(tracking_method_name).with(author: user).twice
described_class.new(issuable, user, params).execute
end
end
context 'for relates_to link type' do
let(:link_type) { IssuableLink::TYPE_RELATES_TO }
let(:tracking_method_name) { :track_linked_epic_with_type_relates_to_added }
it_behaves_like 'a recorded event'
end
context 'for blocks link_type' do
let(:link_type) { IssuableLink::TYPE_BLOCKS }
let(:tracking_method_name) { :track_linked_epic_with_type_blocks_added }
it_behaves_like 'a recorded event'
end
end
end
end
......@@ -200,3 +200,9 @@
redis_slot: project_management
aggregation: daily
feature_flag: track_epics_activity
- name: g_project_management_epic_blocking_added
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