Commit f085ec5f authored by Sean Arnold's avatar Sean Arnold

Create issue automatically from Prometheus alert

parent 1b7292d3
......@@ -34,6 +34,8 @@ module AlertManagement
else
create_alert_management_alert
end
create_incident
end
def reset_alert_management_alert_status
......@@ -89,6 +91,14 @@ module AlertManagement
SystemNoteService.auto_resolve_prometheus_alert(issue, project, User.alert_bot) if issue.reset.closed?
end
def create_incident
clear_memoization(:am_alert) if am_alert.blank?
return unless am_alert
return if am_alert.issue
IncidentManagement::ProcessAlertWorker.new.perform(nil, nil, am_alert.id)
end
def logger
@logger ||= Gitlab::AppLogger
end
......
......@@ -30,7 +30,11 @@ module IncidentManagement
end
def parsed_payload(alert)
Gitlab::Alerting::NotificationPayloadParser.call(alert.payload.to_h, alert.project)
if alert.prometheus?
alert.payload
else
Gitlab::Alerting::NotificationPayloadParser.call(alert.payload.to_h, alert.project)
end
end
def create_issue_for(alert)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment