Commit 80ed7104 authored by Mikołaj Wawrzyniak's avatar Mikołaj Wawrzyniak

Merge branch '292253-cablett-update-epic-note' into 'master'

Track epic update note via usage ping

See merge request gitlab-org/gitlab!56610
parents ce51b660 b9b2d2cd
...@@ -9884,6 +9884,30 @@ Status: `implemented` ...@@ -9884,6 +9884,30 @@ Status: `implemented`
Tiers: `premium`, `ultimate` Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_updating_epic_notes_monthly`
Counts of MAU updating epic notes
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_28d/20210314234202_g_project_management_users_updating_epic_notes_monthly.yml)
Group: `group:product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_updating_epic_notes_weekly`
Counts of WAU updating epic notes
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210314234041_g_project_management_users_updating_epic_notes_weekly.yml)
Group: `group:product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.ide_edit.g_edit_by_sfe_monthly` ### `redis_hll_counters.ide_edit.g_edit_by_sfe_monthly`
Missing description Missing description
......
...@@ -76,6 +76,10 @@ module EE ...@@ -76,6 +76,10 @@ module EE
for_vulnerability? || super for_vulnerability? || super
end end
def usage_ping_track_updated_epic_note(user)
::Gitlab::UsageDataCounters::EpicActivityUniqueCounter.track_epic_note_updated_action(author: user) if for_epic?
end
private private
def system_note_for_epic? def system_note_for_epic?
......
...@@ -13,6 +13,8 @@ module EE ...@@ -13,6 +13,8 @@ module EE
::Gitlab::StatusPage.trigger_publish(project, current_user, updated_note) ::Gitlab::StatusPage.trigger_publish(project, current_user, updated_note)
end end
note.usage_ping_track_updated_epic_note(current_user) if note.for_epic?
updated_note updated_note
end end
end end
......
---
title: Track epic comment updated
merge_request: 56610
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_users_updating_epic_notes_monthly
description: Counts of MAU updating epic notes
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/56610
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_users_updating_epic_notes_weekly
description: Counts of WAU updating epic notes
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/56610
time_frame: 7d
data_source: redis_hll
distribution:
- ee
tier:
- premium
- ultimate
...@@ -8,15 +8,20 @@ module Gitlab ...@@ -8,15 +8,20 @@ module Gitlab
# slot of issue events to allow data aggregation. # slot of issue events to allow data aggregation.
# More information in: https://gitlab.com/gitlab-org/gitlab/-/issues/322405 # More information in: https://gitlab.com/gitlab-org/gitlab/-/issues/322405
EPIC_CREATED = 'g_project_management_epic_created' EPIC_CREATED = 'g_project_management_epic_created'
EPIC_NOTE_UPDATED = 'g_project_management_users_updating_epic_notes'
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_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_START_DATE_SET_AS_INHERITED = 'g_project_management_users_setting_epic_start_date_as_inherited'
EPIC_NOTE_DESTROYED = 'g_project_management_users_destroying_epic_notes'
class << self class << self
def track_epic_created_action(author:, time: Time.zone.now) def track_epic_created_action(author:, time: Time.zone.now)
track_unique_action(EPIC_CREATED, author, time) track_unique_action(EPIC_CREATED, author, time)
end end
def track_epic_note_updated_action(author:, time: Time.zone.now)
track_unique_action(EPIC_NOTE_UPDATED, author, time)
end
def track_epic_note_destroyed_action(author:, time: Time.zone.now) def track_epic_note_destroyed_action(author:, time: Time.zone.now)
track_unique_action(EPIC_NOTE_DESTROYED, author, time) track_unique_action(EPIC_NOTE_DESTROYED, author, time)
end end
......
...@@ -20,6 +20,18 @@ RSpec.describe Gitlab::UsageDataCounters::EpicActivityUniqueCounter, :clean_gitl ...@@ -20,6 +20,18 @@ 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 epic note updated event' do
def track_action(params)
described_class.track_epic_note_updated_action(**params)
end
it_behaves_like 'a daily tracked issuable event' do
let(:action) { described_class::EPIC_NOTE_UPDATED }
end
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
end
context 'for epic note destroyed event' do context 'for epic note destroyed event' do
def track_action(params) def track_action(params)
described_class.track_epic_note_destroyed_action(**params) described_class.track_epic_note_destroyed_action(**params)
......
...@@ -10,11 +10,12 @@ RSpec.describe Notes::UpdateService do ...@@ -10,11 +10,12 @@ RSpec.describe Notes::UpdateService do
create(:note_on_issue, project: project, author: user) create(:note_on_issue, project: project, author: user)
end end
let(:note_text) { 'text' }
let(:opts) { { note: note_text } }
subject(:service) { described_class.new(project, user, opts) } subject(:service) { described_class.new(project, user, opts) }
describe '#execute' do describe '#execute' do
let(:opts) { { note: note_text } }
describe 'publish to status page' do describe 'publish to status page' do
let(:execute) { service.execute(note) } let(:execute) { service.execute(note) }
let(:issue_id) { note.noteable_id } let(:issue_id) { note.noteable_id }
...@@ -25,8 +26,6 @@ RSpec.describe Notes::UpdateService do ...@@ -25,8 +26,6 @@ RSpec.describe Notes::UpdateService do
end end
context 'for text-only update' do context 'for text-only update' do
let(:note_text) { 'text' }
include_examples 'trigger status page publish' include_examples 'trigger status page publish'
context 'without recognized emoji' do context 'without recognized emoji' do
...@@ -49,4 +48,17 @@ RSpec.describe Notes::UpdateService do ...@@ -49,4 +48,17 @@ RSpec.describe Notes::UpdateService do
end end
end end
end end
context 'for epics' do
let_it_be(:epic) { create(:epic) }
let_it_be(:note) { create(:note, noteable: epic) }
subject(:service) { described_class.new(nil, user, opts) }
it 'tracks epic note creation' do
expect(::Gitlab::UsageDataCounters::EpicActivityUniqueCounter).to receive(:track_epic_note_updated_action).with(author: user)
described_class.new(nil, user, opts).execute(note)
end
end
end end
...@@ -9,6 +9,12 @@ ...@@ -9,6 +9,12 @@
aggregation: daily aggregation: daily
feature_flag: track_epics_activity feature_flag: track_epics_activity
- name: g_project_management_users_updating_epic_notes
category: epics_usage
redis_slot: project_management
aggregation: daily
feature_flag: track_epics_activity
- name: g_project_management_users_destroying_epic_notes - name: g_project_management_users_destroying_epic_notes
category: epics_usage category: epics_usage
redis_slot: project_management redis_slot: project_management
......
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