debian-mirror-gitlab/lib/gitlab/tracking/incident_management.rb

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

48 lines
1.2 KiB
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
module Gitlab
module Tracking
module IncidentManagement
class << self
def track_from_params(incident_params)
return if incident_params.blank?
incident_params.each do |k, v|
prefix = ['', '0'].include?(v.to_s) ? 'disabled' : 'enabled'
key = tracking_keys.dig(k, :name)
label = tracking_keys.dig(k, :label)
next if key.blank?
details = label ? { label: label, property: v } : {}
::Gitlab::Tracking.event('IncidentManagement::Settings', "#{prefix}_#{key}", **details )
end
end
def tracking_keys
{
create_issue: {
name: 'issue_auto_creation_on_alerts'
},
issue_template_key: {
name: 'issue_template_on_alerts',
label: 'Template name'
},
send_email: {
name: 'sending_emails'
2020-07-28 23:09:34 +05:30
},
pagerduty_active: {
name: 'pagerduty_webhook'
2020-11-24 15:15:51 +05:30
},
auto_close_incident: {
name: 'auto_close_incident'
2019-12-21 20:55:43 +05:30
}
}.with_indifferent_access.freeze
end
end
end
end
end