Commit b67fa5b4 authored by charlie ablett's avatar charlie ablett

Track epic destroy note via usage ping

- Add usage ping metrics files
parent a3bd306a
...@@ -9812,6 +9812,30 @@ Status: `implemented` ...@@ -9812,6 +9812,30 @@ Status: `implemented`
Tiers: `premium`, `ultimate` Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_destroying_epic_notes_monthly`
Counts of MAU destroying epic notes
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_28d/20210315034808_g_project_management_users_destroying_epic_notes_monthly.yml)
Group: `group:product planning`
Status: `implemented`
Tiers: `premium`, `ultimate`
### `redis_hll_counters.epics_usage.g_project_management_users_destroying_epic_notes_weekly`
Counts of WAU destroying epic notes
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210315034846_g_project_management_users_destroying_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
......
...@@ -11,6 +11,14 @@ module EE ...@@ -11,6 +11,14 @@ module EE
::Analytics::RefreshCommentsData.for_note(note)&.execute(force: true) ::Analytics::RefreshCommentsData.for_note(note)&.execute(force: true)
::Gitlab::StatusPage.trigger_publish(project, current_user, note) ::Gitlab::StatusPage.trigger_publish(project, current_user, note)
track_note_removal_usage_epics if note.for_epic?
end
private
def track_note_removal_usage_epics
::Gitlab::UsageDataCounters::EpicActivityUniqueCounter.track_epic_note_destroyed_action(author: current_user)
end end
end end
end end
......
---
title: Track epic note destroyed
merge_request: 56617
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_destroying_epic_notes_monthly
description: Counts of MAU destroying 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/56617
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_destroying_epic_notes_weekly
description: Counts of WAU destroying 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/56617
time_frame: 7d
data_source: redis_hll
distribution:
- ee
tier:
- premium
- ultimate
...@@ -8,12 +8,17 @@ module Gitlab ...@@ -8,12 +8,17 @@ 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_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_destroyed_action(author:, time: Time.zone.now)
track_unique_action(EPIC_NOTE_DESTROYED, author, time)
end
private private
def track_unique_action(action, author, time) def track_unique_action(action, author, time)
......
...@@ -19,4 +19,16 @@ RSpec.describe Gitlab::UsageDataCounters::EpicActivityUniqueCounter, :clean_gitl ...@@ -19,4 +19,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 epic note destroyed event' do
def track_action(params)
described_class.track_epic_note_destroyed_action(**params)
end
it_behaves_like 'a daily tracked issuable event' do
let(:action) { described_class::EPIC_NOTE_DESTROYED }
end
it_behaves_like 'does not track when feature flag is disabled', :track_epics_activity
end
end end
...@@ -31,5 +31,17 @@ RSpec.describe Notes::DestroyService do ...@@ -31,5 +31,17 @@ RSpec.describe Notes::DestroyService do
include_examples 'trigger status page publish' include_examples 'trigger status page publish'
end end
describe 'tracking via usage ping' do
let_it_be(:note) do
create(:note_on_epic, author: user)
end
it 'tracks epic note destroy' do
expect(::Gitlab::UsageDataCounters::EpicActivityUniqueCounter).to receive(:track_epic_note_destroyed_action)
service.execute(note)
end
end
end end
end end
...@@ -8,3 +8,9 @@ ...@@ -8,3 +8,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_users_destroying_epic_notes
category: epics_usage
redis_slot: project_management
aggregation: daily
feature_flag: track_epics_activity
...@@ -1358,7 +1358,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do ...@@ -1358,7 +1358,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
let(:categories) { ::Gitlab::UsageDataCounters::HLLRedisCounter.categories } let(:categories) { ::Gitlab::UsageDataCounters::HLLRedisCounter.categories }
let(:ineligible_total_categories) do let(:ineligible_total_categories) do
%w[source_code ci_secrets_management incident_management_alerts snippets terraform epics_usage] %w[source_code ci_secrets_management incident_management_alerts snippets terraform]
end end
it 'has all known_events' do it 'has all known_events' do
......
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