Commit ac29d813 authored by Kerri Miller's avatar Kerri Miller

Add approval rule create/update/delete events

Adds approval rule CUD tracking events.
parent a933750e
---
name: usage_data_i_code_review_user_approval_rule_added
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/issues/320966
rollout_issue_url:
milestone: '13.9'
type: development
group: group::code review
default_enabled: true
---
name: usage_data_i_code_review_user_approval_rule_deleted
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/issues/320966
rollout_issue_url:
milestone: '13.9'
type: development
group: group::code review
default_enabled: true
---
name: usage_data_i_code_review_user_approval_rule_edited
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/issues/320966
rollout_issue_url:
milestone: '13.9'
type: development
group: group::code review
default_enabled: true
...@@ -124,3 +124,18 @@ ...@@ -124,3 +124,18 @@
category: code_review category: code_review
aggregation: weekly aggregation: weekly
feature_flag: usage_data_i_code_review_user_review_requested feature_flag: usage_data_i_code_review_user_review_requested
- name: i_code_review_user_approval_rule_added
redis_slot: code_review
category: code_review
aggregation: weekly
feature_flag: usage_data_i_code_review_user_approval_rule_added
- name: i_code_review_user_approval_rule_deleted
redis_slot: code_review
category: code_review
aggregation: weekly
feature_flag: usage_data_i_code_review_user_approval_rule_deleted
- name: i_code_review_user_approval_rule_edited
redis_slot: code_review
category: code_review
aggregation: weekly
feature_flag: usage_data_i_code_review_user_approval_rule_edited
...@@ -26,6 +26,9 @@ module Gitlab ...@@ -26,6 +26,9 @@ module Gitlab
MR_UNRESOLVE_THREAD_ACTION = 'i_code_review_user_unresolve_thread' MR_UNRESOLVE_THREAD_ACTION = 'i_code_review_user_unresolve_thread'
MR_ASSIGNED_USERS_ACTION = 'i_code_review_user_assigned' MR_ASSIGNED_USERS_ACTION = 'i_code_review_user_assigned'
MR_REVIEW_REQUESTED_USERS_ACTION = 'i_code_review_user_review_requested' MR_REVIEW_REQUESTED_USERS_ACTION = 'i_code_review_user_review_requested'
MR_APPROVAL_RULE_ADDED_USERS_ACTION = 'i_code_review_user_approval_rule_added'
MR_APPROVAL_RULE_EDITED_USERS_ACTION = 'i_code_review_user_approval_rule_edited'
MR_APPROVAL_RULE_DELETED_USERS_ACTION = 'i_code_review_user_approval_rule_deleted'
MR_EDIT_MR_TITLE_ACTION = 'i_code_review_edit_mr_title' MR_EDIT_MR_TITLE_ACTION = 'i_code_review_edit_mr_title'
MR_EDIT_MR_DESC_ACTION = 'i_code_review_edit_mr_desc' MR_EDIT_MR_DESC_ACTION = 'i_code_review_edit_mr_desc'
...@@ -118,6 +121,18 @@ module Gitlab ...@@ -118,6 +121,18 @@ module Gitlab
track_unique_action_by_user(MR_EDIT_MR_DESC_ACTION, user) track_unique_action_by_user(MR_EDIT_MR_DESC_ACTION, user)
end end
def track_approval_rule_added_action(user:)
track_unique_action_by_user(MR_APPROVAL_RULE_ADDED_USERS_ACTION, user)
end
def track_approval_rule_edited_action(user:)
track_unique_action_by_user(MR_APPROVAL_RULE_EDITED_USERS_ACTION, user)
end
def track_approval_rule_deleted_action(user:)
track_unique_action_by_user(MR_APPROVAL_RULE_DELETED_USERS_ACTION, user)
end
private private
def track_unique_action_by_merge_request(action, merge_request) def track_unique_action_by_merge_request(action, merge_request)
......
...@@ -228,4 +228,28 @@ RSpec.describe Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter, :cl ...@@ -228,4 +228,28 @@ RSpec.describe Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter, :cl
let(:action) { described_class::MR_REVIEW_REQUESTED_USERS_ACTION } let(:action) { described_class::MR_REVIEW_REQUESTED_USERS_ACTION }
end end
end end
describe '.track_approval_rule_added_action' do
subject { described_class.track_approval_rule_added_action(user: user) }
it_behaves_like 'a tracked merge request unique event' do
let(:action) { described_class::MR_APPROVAL_RULE_ADDED_USERS_ACTION }
end
end
describe '.track_approval_rule_edited_action' do
subject { described_class.track_approval_rule_edited_action(user: user) }
it_behaves_like 'a tracked merge request unique event' do
let(:action) { described_class::MR_APPROVAL_RULE_EDITED_USERS_ACTION }
end
end
describe '.track_approval_rule_deleted_action' do
subject { described_class.track_approval_rule_deleted_action(user: user) }
it_behaves_like 'a tracked merge request unique event' do
let(:action) { described_class::MR_APPROVAL_RULE_DELETED_USERS_ACTION }
end
end
end end
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