2020-08-20 14:10:16 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Attribute mapping for alerts via generic alerting integration.
|
|
|
|
module Gitlab
|
|
|
|
module AlertManagement
|
|
|
|
module Payload
|
|
|
|
class Generic < Base
|
2021-02-23 01:11:16 -05:00
|
|
|
DEFAULT_TITLE = 'New: Alert'
|
2020-08-20 14:10:16 -04:00
|
|
|
|
2020-09-22 08:09:39 -04:00
|
|
|
attribute :description, paths: 'description'
|
|
|
|
attribute :ends_at, paths: 'end_time', type: :time
|
2020-08-26 05:10:16 -04:00
|
|
|
attribute :environment_name, paths: 'gitlab_environment_name'
|
2020-08-20 14:10:16 -04:00
|
|
|
attribute :hosts, paths: 'hosts'
|
|
|
|
attribute :monitoring_tool, paths: 'monitoring_tool'
|
|
|
|
attribute :runbook, paths: 'runbook'
|
|
|
|
attribute :service, paths: 'service'
|
|
|
|
attribute :starts_at, paths: 'start_time', type: :time, fallback: -> { Time.current.utc }
|
|
|
|
attribute :title, paths: 'title', fallback: -> { DEFAULT_TITLE }
|
|
|
|
|
2021-02-12 10:08:43 -05:00
|
|
|
attribute :severity_raw, paths: 'severity'
|
|
|
|
private :severity_raw
|
|
|
|
|
2020-08-20 14:10:16 -04:00
|
|
|
attribute :plain_gitlab_fingerprint, paths: 'fingerprint'
|
|
|
|
private :plain_gitlab_fingerprint
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2020-09-22 08:09:39 -04:00
|
|
|
|
2021-05-11 17:10:21 -04:00
|
|
|
Gitlab::AlertManagement::Payload::Generic.prepend_mod_with('Gitlab::AlertManagement::Payload::Generic')
|