Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-21 15:09:07 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-21 15:09:07 +0300
commit2a040e2655fe0a99df61ad0a7bd0c27e68af0c38 (patch)
treea245cd0d6dd10f185e2fd098e371adc1ea03b72b /app/services/projects
parenta53d2c37c4934f564caa94543dd4cf5af1703e2d (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/projects')
-rw-r--r--app/services/projects/alerting/notify_service.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/app/services/projects/alerting/notify_service.rb b/app/services/projects/alerting/notify_service.rb
index 4ca3b154e4b..d34d6f6a915 100644
--- a/app/services/projects/alerting/notify_service.rb
+++ b/app/services/projects/alerting/notify_service.rb
@@ -4,12 +4,14 @@ module Projects
module Alerting
class NotifyService < BaseService
include Gitlab::Utils::StrongMemoize
+ include IncidentManagement::Settings
def execute(token)
return forbidden unless alerts_service_activated?
return unauthorized unless valid_token?(token)
- process_incident_issues
+ process_incident_issues if process_issues?
+ send_alert_email if send_email?
ServiceResponse.success
rescue Gitlab::Alerting::NotificationPayloadParser::BadPayloadError
@@ -20,11 +22,21 @@ module Projects
delegate :alerts_service, :alerts_service_activated?, to: :project
+ def send_email?
+ incident_management_setting.send_email?
+ end
+
def process_incident_issues
IncidentManagement::ProcessAlertWorker
.perform_async(project.id, parsed_payload)
end
+ def send_alert_email
+ notification_service
+ .async
+ .prometheus_alerts_fired(project, [parsed_payload])
+ end
+
def parsed_payload
Gitlab::Alerting::NotificationPayloadParser.call(params.to_h)
end