Module: Gitlab::Tracking::IncidentManagement

Defined in:
lib/gitlab/tracking/incident_management.rb

Class Method Summary collapse

Class Method Details

.track_from_params(incident_params) ⇒ Object


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/gitlab/tracking/incident_management.rb', line 7

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

.tracking_keysObject


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/gitlab/tracking/incident_management.rb', line 24

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'
    },
    pagerduty_active: {
      name: 'pagerduty_webhook'
    },
    auto_close_incident: {
      name: 'auto_close_incident'
    }
  }.with_indifferent_access.freeze
end