debian-mirror-gitlab/app/services/concerns/incident_management/usage_data.rb
2023-03-05 14:24:40 +05:30

29 lines
874 B
Ruby

# frozen_string_literal: true
module IncidentManagement
module UsageData
include Gitlab::Utils::UsageData
def track_incident_action(current_user, target, action)
return unless target.incident?
event = "incident_management_#{action}"
track_usage_event(event, current_user.id)
namespace = target.try(:namespace)
project = target.try(:project)
return unless Feature.enabled?(:route_hll_to_snowplow_phase2, target.try(:namespace))
Gitlab::Tracking.event(
self.class.to_s,
event,
project: project,
namespace: namespace,
user: current_user,
label: 'redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly',
context: [Gitlab::Tracking::ServicePingContext.new(data_source: :redis_hll, event: event).to_context]
)
end
end
end