Commit 78eb758e authored by Tetiana Chupryna's avatar Tetiana Chupryna

Merge branch 'issue_355471-count_blocking_epics_removed_on_usage_data' into 'master'

Track blocking epics removed on usage ping

See merge request gitlab-org/gitlab!84408
parents cb0c29e4 798a0188
# frozen_string_literal: true # frozen_string_literal: true
# Helper to simplify recording related epics unique events on services.
# Used by RelatedEpicLinks::CreateService and RelatedEpicLinks::DestroyService
#
# Calls the following methods on Gitlab::UsageDataCounters::EpicActivityUniqueCounter:
#
# track_linked_epic_with_type_relates_to_added
# track_linked_epic_with_type_relates_to_removed
# track_linked_epic_with_type_blocks_added
# track_linked_epic_with_type_blocks_removed
# track_linked_epic_with_type_is_blocked_by_added
# track_linked_epic_with_type_is_blocked_by_removed
module Epics::RelatedEpicLinks::UsageDataHelper module Epics::RelatedEpicLinks::UsageDataHelper
ALLOWED_LINK_TYPES = ALLOWED_LINK_TYPES =
[ [
......
...@@ -47,6 +47,7 @@ options: ...@@ -47,6 +47,7 @@ options:
- g_project_management_epic_related_added - g_project_management_epic_related_added
- g_project_management_epic_related_removed - g_project_management_epic_related_removed
- g_project_management_epic_blocking_added - g_project_management_epic_blocking_added
- g_project_management_epic_blocking_removed
distribution: distribution:
- ee - ee
tier: tier:
......
---
key_path: redis_hll_counters.epics_usage.g_project_management_epic_blocking_removed_monthly
description: Count of MAU removing 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/84408
time_frame: 28d
data_source: redis_hll
data_category: optional
instrumentation_class: RedisHLLMetric
options:
events:
- g_project_management_epic_blocking_removed
distribution:
- ee
tier:
- ultimate
...@@ -47,6 +47,7 @@ options: ...@@ -47,6 +47,7 @@ options:
- g_project_management_epic_related_added - g_project_management_epic_related_added
- g_project_management_epic_related_removed - g_project_management_epic_related_removed
- g_project_management_epic_blocking_added - g_project_management_epic_blocking_added
- g_project_management_epic_blocking_removed
distribution: distribution:
- ee - ee
tier: tier:
......
---
key_path: redis_hll_counters.epics_usage.g_project_management_epic_blocking_removed_weekly
description: Count of WAU removing 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/84408
time_frame: 7d
data_source: redis_hll
data_category: optional
instrumentation_class: RedisHLLMetric
options:
events:
- g_project_management_epic_blocking_removed
distribution:
- ee
tier:
- ultimate
...@@ -38,6 +38,7 @@ module Gitlab ...@@ -38,6 +38,7 @@ module Gitlab
EPIC_RELATED_ADDED = 'g_project_management_epic_related_added' EPIC_RELATED_ADDED = 'g_project_management_epic_related_added'
EPIC_RELATED_REMOVED = 'g_project_management_epic_related_removed' EPIC_RELATED_REMOVED = 'g_project_management_epic_related_removed'
EPIC_BLOCKING_ADDED = 'g_project_management_epic_blocking_added' EPIC_BLOCKING_ADDED = 'g_project_management_epic_blocking_added'
EPIC_BLOCKING_REMOVED = 'g_project_management_epic_blocking_removed'
class << self class << self
def track_epic_created_action(author:) def track_epic_created_action(author:)
...@@ -165,6 +166,7 @@ module Gitlab ...@@ -165,6 +166,7 @@ module Gitlab
end end
def track_linked_epic_with_type_blocks_removed(author:) def track_linked_epic_with_type_blocks_removed(author:)
track_unique_action(EPIC_BLOCKING_REMOVED, author)
end end
def track_linked_epic_with_type_is_blocked_by_added(author:) def track_linked_epic_with_type_is_blocked_by_added(author:)
......
...@@ -373,4 +373,16 @@ RSpec.describe Gitlab::UsageDataCounters::EpicActivityUniqueCounter, :clean_gitl ...@@ -373,4 +373,16 @@ RSpec.describe Gitlab::UsageDataCounters::EpicActivityUniqueCounter, :clean_gitl
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
end end
context 'for blocking epic removed' do
def track_action(params)
described_class.track_linked_epic_with_type_blocks_removed(**params)
end
it_behaves_like 'a daily tracked issuable event' do
let(:action) { described_class::EPIC_BLOCKING_REMOVED }
end
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
end
end end
...@@ -17,19 +17,35 @@ RSpec.describe Epics::RelatedEpicLinks::DestroyService do ...@@ -17,19 +17,35 @@ RSpec.describe Epics::RelatedEpicLinks::DestroyService do
it_behaves_like 'a destroyable issuable link' it_behaves_like 'a destroyable issuable link'
context 'event tracking' do context 'event tracking' do
let(:issuable_link) { create(:related_epic_link, link_type: link_type ) }
before do before do
issuable_link.source.resource_parent.add_reporter(user) issuable_link.source.resource_parent.add_reporter(user)
issuable_link.target.resource_parent.add_reporter(user) issuable_link.target.resource_parent.add_reporter(user)
end end
context 'for relates_to link type' do shared_examples 'a recorded event' do
it 'records event for related epic link destroyed' do it 'records event for destroyed link' do
expect(Gitlab::UsageDataCounters::EpicActivityUniqueCounter) expect(Gitlab::UsageDataCounters::EpicActivityUniqueCounter)
.to receive(:track_linked_epic_with_type_relates_to_removed).with(author: user).once .to receive(tracking_method).with(author: user).once
subject subject
end end
end end
context 'for relates_to link type' do
let(:link_type) { IssuableLink::TYPE_RELATES_TO }
let(:tracking_method) { :track_linked_epic_with_type_relates_to_removed }
it_behaves_like 'a recorded event'
end
context 'for blocks link type' do
let(:link_type) { IssuableLink::TYPE_BLOCKS }
let(:tracking_method) { :track_linked_epic_with_type_blocks_removed }
it_behaves_like 'a recorded event'
end
end end
end end
end end
...@@ -206,3 +206,9 @@ ...@@ -206,3 +206,9 @@
redis_slot: project_management redis_slot: project_management
aggregation: daily aggregation: daily
feature_flag: track_epics_activity feature_flag: track_epics_activity
- name: g_project_management_epic_blocking_removed
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