debian-mirror-gitlab/lib/gitlab/usage_data_counters/work_item_activity_unique_counter.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

48 lines
1.5 KiB
Ruby
Raw Normal View History

2022-05-07 20:08:51 +05:30
# frozen_string_literal: true
module Gitlab
module UsageDataCounters
module WorkItemActivityUniqueCounter
WORK_ITEM_CREATED = 'users_creating_work_items'
WORK_ITEM_TITLE_CHANGED = 'users_updating_work_item_title'
2022-08-27 11:52:29 +05:30
WORK_ITEM_DATE_CHANGED = 'users_updating_work_item_dates'
2022-11-25 23:54:43 +05:30
WORK_ITEM_LABELS_CHANGED = 'users_updating_work_item_labels'
2023-01-13 00:05:48 +05:30
WORK_ITEM_MILESTONE_CHANGED = 'users_updating_work_item_milestone'
2022-05-07 20:08:51 +05:30
class << self
def track_work_item_created_action(author:)
track_unique_action(WORK_ITEM_CREATED, author)
end
def track_work_item_title_changed_action(author:)
track_unique_action(WORK_ITEM_TITLE_CHANGED, author)
end
2022-08-27 11:52:29 +05:30
def track_work_item_date_changed_action(author:)
track_unique_action(WORK_ITEM_DATE_CHANGED, author)
end
2022-11-25 23:54:43 +05:30
def track_work_item_labels_changed_action(author:)
track_unique_action(WORK_ITEM_LABELS_CHANGED, author)
end
2023-01-13 00:05:48 +05:30
def track_work_item_milestone_changed_action(author:)
track_unique_action(WORK_ITEM_MILESTONE_CHANGED, author)
end
2022-05-07 20:08:51 +05:30
private
def track_unique_action(action, author)
return unless author
Gitlab::UsageDataCounters::HLLRedisCounter.track_event(action, values: author.id)
end
end
end
end
end
2022-08-13 15:12:31 +05:30
# rubocop:disable Layout/LineLength
Gitlab::UsageDataCounters::WorkItemActivityUniqueCounter.prepend_mod_with('Gitlab::UsageDataCounters::WorkItemActivityUniqueCounter')
# rubocop:enable Layout/LineLength