summaryrefslogtreecommitdiff
path: root/app/services/projects/prometheus/alerts/notify_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/projects/prometheus/alerts/notify_service.rb')
-rw-r--r--app/services/projects/prometheus/alerts/notify_service.rb23
1 files changed, 1 insertions, 22 deletions
diff --git a/app/services/projects/prometheus/alerts/notify_service.rb b/app/services/projects/prometheus/alerts/notify_service.rb
index c002aca32db..8ad4f59373d 100644
--- a/app/services/projects/prometheus/alerts/notify_service.rb
+++ b/app/services/projects/prometheus/alerts/notify_service.rb
@@ -17,13 +17,12 @@ module Projects
SUPPORTED_VERSION = '4'
- def execute(token)
+ def execute(token, _integration = nil)
return bad_request unless valid_payload_size?
return unprocessable_entity unless self.class.processable?(params)
return unauthorized unless valid_alert_manager_token?(token)
process_prometheus_alerts
- send_alert_email if send_email?
ServiceResponse.success
end
@@ -120,14 +119,6 @@ module Projects
ActiveSupport::SecurityUtils.secure_compare(expected, actual)
end
- def send_alert_email
- return unless firings.any?
-
- notification_service
- .async
- .prometheus_alerts_fired(project, alerts_attributes)
- end
-
def process_prometheus_alerts
alerts.each do |alert|
AlertManagement::ProcessPrometheusAlertService
@@ -136,18 +127,6 @@ module Projects
end
end
- def alerts_attributes
- firings.map do |payload|
- alert_params = Gitlab::AlertManagement::Payload.parse(
- project,
- payload,
- monitoring_tool: Gitlab::AlertManagement::Payload::MONITORING_TOOLS[:prometheus]
- ).alert_params
-
- AlertManagement::Alert.new(alert_params).attributes
- end
- end
-
def bad_request
ServiceResponse.error(message: 'Bad Request', http_status: :bad_request)
end