diff options
Diffstat (limited to 'app/models/project_services/prometheus_service.rb')
-rw-r--r-- | app/models/project_services/prometheus_service.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/project_services/prometheus_service.rb b/app/models/project_services/prometheus_service.rb index 17bc29ebdcf..30dfcc11417 100644 --- a/app/models/project_services/prometheus_service.rb +++ b/app/models/project_services/prometheus_service.rb @@ -24,6 +24,8 @@ class PrometheusService < MonitoringService after_commit :track_events + after_create_commit :create_default_alerts + def initialize_properties if properties.nil? self.properties = {} @@ -147,4 +149,10 @@ class PrometheusService < MonitoringService def disabled_manual_prometheus? manual_configuration_changed? && !manual_configuration? end + + def create_default_alerts + return unless project_id + + Prometheus::CreateDefaultAlertsWorker.perform_async(project_id: project_id) + end end |