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:
Diffstat (limited to 'app/services/prometheus/create_default_alerts_service.rb')
-rw-r--r--app/services/prometheus/create_default_alerts_service.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/services/prometheus/create_default_alerts_service.rb b/app/services/prometheus/create_default_alerts_service.rb
index c87cbbbe3cf..53baf6a650e 100644
--- a/app/services/prometheus/create_default_alerts_service.rb
+++ b/app/services/prometheus/create_default_alerts_service.rb
@@ -33,6 +33,7 @@ module Prometheus
return ServiceResponse.error(message: 'Invalid environment') unless environment
create_alerts
+ schedule_prometheus_update
ServiceResponse.success
end
@@ -51,6 +52,16 @@ module Prometheus
end
end
+ def schedule_prometheus_update
+ return unless prometheus_application
+
+ ::Clusters::Applications::ScheduleUpdateService.new(prometheus_application, project).execute
+ end
+
+ def prometheus_application
+ environment.cluster_prometheus_adapter
+ end
+
def metrics_by_identifier
strong_memoize(:metrics_by_identifier) do
metric_identifiers = DEFAULT_ALERTS.map { |alert| alert[:identifier] }