Module: Gitlab::UsageDataCounters::QuickActionActivityUniqueCounter

Defined in:
lib/gitlab/usage_data_counters/quick_action_activity_unique_counter.rb

Constant Summary collapse

INTERNAL_EVENTS =

List of events that use the current internal events implementation. Only add internal events for new quick actions.

%w[
  add_email_multiple
  add_email_single
  convert_to_ticket
  remove_email_multiple
  remove_email_single
  q
  status
  ship
  run_pipeline
  approve
  submit_review
  unapprove
].freeze

Class Method Summary collapse

Class Method Details

.track_unique_action(name, args:, user:, project:, additional_properties: nil) ⇒ Object

Tracks the quick action with name name. args is expected to be a single string, will be split internally when necessary.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/gitlab/usage_data_counters/quick_action_activity_unique_counter.rb', line 26

def track_unique_action(name, args:, user:, project:, additional_properties: nil)
  return unless user

  args ||= ''
  name = prepare_name(name, args)

  if INTERNAL_EVENTS.include?(name)
    Gitlab::InternalEvents.track_event(
      "i_quickactions_#{name}",
      user: user,
      project: project,
      additional_properties: additional_properties || prepare_additional_properties(name, args)
    )
  else
    # Legacy event implementation. Migrate existing events to internal events.
    # See implementation of `convert_to_ticket` quickaction and
    # https://docs.gitlab.com/ee/development/internal_analytics/internal_event_instrumentation/migration.html#backend-1
    Gitlab::UsageDataCounters::HLLRedisCounter.track_event(:"i_quickactions_#{name}", values: user.id)
  end
end