diff --git a/doc/development/usage_ping/dictionary.md b/doc/development/usage_ping/dictionary.md index 02417041d2a53f740aff248b2b548f48a64525ed..45a1c5c29fa70cc7867a55418ee20b0ec6db7fbe 100644 --- a/doc/development/usage_ping/dictionary.md +++ b/doc/development/usage_ping/dictionary.md @@ -9836,6 +9836,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 diff --git a/ee/app/services/epic_issues/create_service.rb b/ee/app/services/epic_issues/create_service.rb index 7380a41466d03c7cb0a01dd985682b972818f06e..466de241a31a17eb55ac00565bd6c88bccf9a9c5 100644 --- a/ee/app/services/epic_issues/create_service.rb +++ b/ee/app/services/epic_issues/create_service.rb @@ -19,6 +19,7 @@ def relate_issuables(referenced_issue) if link.save create_notes(referenced_issue, params) + usage_ping_record_epic_issue_added end link @@ -64,5 +65,9 @@ def previous_related_issuables 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 diff --git a/ee/changelogs/unreleased/issue_292253-track_epic_issue.yml b/ee/changelogs/unreleased/issue_292253-track_epic_issue.yml new file mode 100644 index 0000000000000000000000000000000000000000..4e31f30fb3428b8f039e978c7e64bbb93cb9ece1 --- /dev/null +++ b/ee/changelogs/unreleased/issue_292253-track_epic_issue.yml @@ -0,0 +1,5 @@ +--- +title: Record issues added to epic on usage ping +merge_request: 56559 +author: +type: other diff --git a/ee/config/metrics/counts_28d/20210312144719_g_product_planning_epic_issue_added_monthly.yml b/ee/config/metrics/counts_28d/20210312144719_g_product_planning_epic_issue_added_monthly.yml new file mode 100644 index 0000000000000000000000000000000000000000..95d8055707799e7a3191a8a619ad86106b48b1b2 --- /dev/null +++ b/ee/config/metrics/counts_28d/20210312144719_g_product_planning_epic_issue_added_monthly.yml @@ -0,0 +1,21 @@ +--- +# 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 diff --git a/ee/config/metrics/counts_7d/20210312181918_g_product_planning_epic_issue_added_weekly.yml b/ee/config/metrics/counts_7d/20210312181918_g_product_planning_epic_issue_added_weekly.yml new file mode 100644 index 0000000000000000000000000000000000000000..10b488cff46451d7a87c73d0198b69dd739c2457 --- /dev/null +++ b/ee/config/metrics/counts_7d/20210312181918_g_product_planning_epic_issue_added_weekly.yml @@ -0,0 +1,21 @@ +--- +# 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 diff --git a/ee/lib/gitlab/usage_data_counters/epic_activity_unique_counter.rb b/ee/lib/gitlab/usage_data_counters/epic_activity_unique_counter.rb index ee1c02edcdb09820eabbd8033b9e3085c979603e..4513d3fddabc50d46186730603e7445f28830439 100644 --- a/ee/lib/gitlab/usage_data_counters/epic_activity_unique_counter.rb +++ b/ee/lib/gitlab/usage_data_counters/epic_activity_unique_counter.rb @@ -12,6 +12,7 @@ module EpicActivityUniqueCounter 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 @@ def track_epic_start_date_set_as_inherited_action(author:, time: Time.zone.now) 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) diff --git a/ee/spec/lib/gitlab/usage_data_counters/epic_activity_unique_counter_spec.rb b/ee/spec/lib/gitlab/usage_data_counters/epic_activity_unique_counter_spec.rb index 2d9ac5223e92f6f603f52d981103922b3e9ab2ce..2b3cda7989bcfd330aecc34628e78b877130f692 100644 --- a/ee/spec/lib/gitlab/usage_data_counters/epic_activity_unique_counter_spec.rb +++ b/ee/spec/lib/gitlab/usage_data_counters/epic_activity_unique_counter_spec.rb @@ -69,4 +69,16 @@ def track_action(params) 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 diff --git a/ee/spec/services/epic_issues/create_service_spec.rb b/ee/spec/services/epic_issues/create_service_spec.rb index c41ec0e0171a6564cdd02abb345bf9ae98bc698e..09c804f66252e99d8c8a50345bd9ce80c7981e04 100644 --- a/ee/spec/services/epic_issues/create_service_spec.rb +++ b/ee/spec/services/epic_issues/create_service_spec.rb @@ -66,6 +66,12 @@ def assign_issue(references) 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 diff --git a/lib/gitlab/usage_data_counters/known_events/epic_events.yml b/lib/gitlab/usage_data_counters/known_events/epic_events.yml index 7cd2a72d8caf38466c9b51f420911ab3c8243818..79dfae981571030ef793e5b57bf2039ee8649af2 100644 --- a/lib/gitlab/usage_data_counters/known_events/epic_events.yml +++ b/lib/gitlab/usage_data_counters/known_events/epic_events.yml @@ -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