Commit 7a4c6e06 authored by Felipe Artur's avatar Felipe Artur

Record issues added to epic on usage ping

Record issues addded to epic by users
using HLL redis counters.
parent 9e60cb39
......@@ -9812,6 +9812,30 @@ Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_epic_issue_added_monthly`
Count of MAU adding issues to epics
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_28d/20210312144719_g_product_planning_epic_issue_added_monthly.yml)
Group: `group::product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_epic_issue_added_weekly`
Count of WAU adding issues to epics
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210312181918_g_product_planning_epic_issue_added_weekly.yml)
Group: `group::product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_destroying_epic_notes_monthly`
Counts of MAU destroying epic notes
......
......@@ -19,6 +19,7 @@ module EpicIssues
if link.save
create_notes(referenced_issue, params)
usage_ping_record_epic_issue_added
end
link
......@@ -64,5 +65,9 @@ module EpicIssues
def issuable_group_descendants
@descendants ||= issuable.group.self_and_descendants
end
def usage_ping_record_epic_issue_added
::Gitlab::UsageDataCounters::EpicActivityUniqueCounter.track_epic_issue_added(author: current_user)
end
end
end
---
title: Record issues added to epic on usage ping
merge_request: 56559
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_epic_issue_added_monthly
description: Count of MAU adding 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/56559
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_epic_issue_added_weekly
description: Count of WAU adding 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/56559
time_frame: 7d
data_source: redis_hll
distribution:
- ee
tier:
- premium
- ultimate
......@@ -12,6 +12,7 @@ module Gitlab
EPIC_NOTE_DESTROYED = 'g_project_management_users_destroying_epic_notes'
EPIC_START_DATE_SET_AS_FIXED = 'g_project_management_users_setting_epic_start_date_as_fixed'
EPIC_START_DATE_SET_AS_INHERITED = 'g_project_management_users_setting_epic_start_date_as_inherited'
EPIC_ISSUE_ADDED = 'g_project_management_epic_issue_added'
class << self
def track_epic_created_action(author:, time: Time.zone.now)
......@@ -34,6 +35,10 @@ module Gitlab
track_unique_action(EPIC_START_DATE_SET_AS_INHERITED, author, time)
end
def track_epic_issue_added(author:, time: Time.zone.now)
track_unique_action(EPIC_ISSUE_ADDED, author, time)
end
private
def track_unique_action(action, author, time)
......
......@@ -69,4 +69,16 @@ RSpec.describe Gitlab::UsageDataCounters::EpicActivityUniqueCounter, :clean_gitl
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
end
end
context 'for adding issue to epic event' do
def track_action(params)
described_class.track_epic_issue_added(**params)
end
it_behaves_like 'a daily tracked issuable event' do
let(:action) { described_class::EPIC_ISSUE_ADDED }
end
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
end
end
......@@ -66,6 +66,12 @@ RSpec.describe EpicIssues::CreateService do
expect(note.noteable_type).to eq('Issue')
expect(note.system_note_metadata.action).to eq('issue_added_to_epic')
end
it 'records action on usage ping' do
expect(::Gitlab::UsageDataCounters::EpicActivityUniqueCounter).to receive(:track_epic_issue_added).with(author: user)
subject
end
end
shared_examples 'returns an error' do
......
......@@ -32,3 +32,9 @@
redis_slot: project_management
aggregation: daily
feature_flag: track_epics_activity
- name: g_project_management_epic_issue_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