Commit 8322da8e authored by charlie ablett's avatar charlie ablett

Merge branch '292253-cablett-epic-emoji' into 'master'

Track users awarding epic emoji via usage ping

See merge request gitlab-org/gitlab!60787
parents 1803cbf3 103d9b68
......@@ -10460,6 +10460,30 @@ Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_awarding_epic_emoji_monthly`
Counts of MAU awarding emoji on epic
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_28d/20210503011217_g_project_management_users_awarding_epic_emoji_monthly.yml)
Group: `group::product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_awarding_epic_emoji_weekly`
Counts of WAU awarding emoji on epic
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210503011355_g_project_management_users_awarding_epic_emoji_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
......
......@@ -12,6 +12,11 @@ module EE
super
::Gitlab::StatusPage.trigger_publish(project, current_user, award)
track_epic_emoji_awarded if awardable.is_a?(Epic)
end
def track_epic_emoji_awarded
::Gitlab::UsageDataCounters::EpicActivityUniqueCounter.track_epic_emoji_awarded_action(author: current_user)
end
end
end
......
---
title: Track epic emoji award via usage ping
merge_request: 60787
author:
type: other
---
key_path: redis_hll_counters.epics_usage.g_project_management_users_awarding_epic_emoji_monthly
description: Counts of MAU awarding emoji on epic
product_section: dev
product_stage: plan
product_group: group::product planning
product_category: epics_usage
value_type: number
status: implemented
milestone: "13.12"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/60787
time_frame: 28d
data_source: redis_hll
distribution:
- ee
tier:
- premium
- ultimate
---
key_path: redis_hll_counters.epics_usage.g_project_management_users_awarding_epic_emoji_weekly
description: Counts of WAU awarding emoji on epic
product_section: dev
product_stage: plan
product_group: group::product planning
product_category: epics_usage
value_type: number
status: implemented
milestone: "13.12"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/60787
time_frame: 28d
data_source: redis_hll
distribution:
- ee
tier:
- premium
- ultimate
......@@ -13,6 +13,7 @@ module Gitlab
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'
EPIC_EMOJI_AWARDED = 'g_project_management_users_awarding_epic_emoji'
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_DUE_DATE_SET_AS_FIXED = 'g_project_management_users_setting_epic_due_date_as_fixed'
......@@ -57,6 +58,10 @@ module Gitlab
track_unique_action(EPIC_NOTE_DESTROYED, author)
end
def track_epic_emoji_awarded_action(author:)
track_unique_action(EPIC_EMOJI_AWARDED, author)
end
def track_epic_start_date_set_as_fixed_action(author:)
track_unique_action(EPIC_START_DATE_SET_AS_FIXED, author)
end
......
......@@ -74,6 +74,16 @@ RSpec.describe Gitlab::UsageDataCounters::EpicActivityUniqueCounter, :clean_gitl
end
end
context 'for epic emoji award event' do
def track_action(params)
described_class.track_epic_emoji_awarded_action(**params)
end
it_behaves_like 'a daily tracked issuable event' do
let(:action) { described_class::EPIC_EMOJI_AWARDED }
end
end
context 'for epic closing event' do
def track_action(params)
described_class.track_epic_closed_action(**params)
......
......@@ -4,16 +4,18 @@ require 'spec_helper'
RSpec.describe AwardEmojis::AddService do
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project) }
let_it_be(:group) { create(:group, :public) }
let_it_be(:project) { create(:project, group: group) }
let_it_be(:awardable) { create(:note_on_issue, project: project) }
let(:name) { 'thumbsup' }
subject(:service) { described_class.new(awardable, name, user) }
let(:service) { described_class.new(awardable, name, user) }
describe '#execute' do
subject(:execute) { service.execute }
describe 'publish to status page' do
let(:execute) { service.execute }
let(:issue_id) { awardable.noteable_id }
context 'when adding succeeds' do
......@@ -36,5 +38,30 @@ RSpec.describe AwardEmojis::AddService do
include_examples 'no trigger status page publish'
end
end
describe 'tracking emoji adding' do
context 'for epics' do
let_it_be(:awardable) { create(:epic, group: group) }
before do
stub_licensed_features(epics: true)
group.add_developer(user)
end
it 'tracks usage' do
expect(::Gitlab::UsageDataCounters::EpicActivityUniqueCounter).to receive(:track_epic_emoji_awarded_action)
described_class.new(awardable, name, user).execute
end
end
context 'for awardables that are not epics' do
it 'does not track epic emoji awarding' do
expect(::Gitlab::UsageDataCounters::EpicActivityUniqueCounter).not_to receive(:track_epic_emoji_awarded_action)
execute
end
end
end
end
end
......@@ -55,6 +55,14 @@
aggregation: daily
feature_flag: track_epics_activity
# emoji
- name: g_project_management_users_awarding_epic_emoji
category: epics_usage
redis_slot: project_management
aggregation: daily
feature_flag: track_epics_activity
# start date events
- name: g_project_management_users_setting_epic_start_date_as_fixed
......
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