2020-04-22 19:07:51 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Prometheus
|
|
|
|
class CreateDefaultAlertsWorker
|
|
|
|
include ApplicationWorker
|
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
data_consistency :always
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
sidekiq_options retry: 3
|
|
|
|
|
2020-04-22 19:07:51 +05:30
|
|
|
feature_category :incident_management
|
|
|
|
urgency :high
|
|
|
|
idempotent!
|
|
|
|
|
|
|
|
def perform(project_id)
|
|
|
|
project = Project.find_by_id(project_id)
|
|
|
|
|
|
|
|
return unless project
|
|
|
|
|
2021-09-30 23:02:18 +05:30
|
|
|
result = ::Prometheus::CreateDefaultAlertsService.new(project: project).execute
|
2020-04-22 19:07:51 +05:30
|
|
|
|
|
|
|
log_info(result.message) if result.error?
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def log_info(message)
|
|
|
|
logger.info(structured_payload(message: message))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|