28 lines
551 B
Ruby
28 lines
551 B
Ruby
![]() |
# frozen_string_literal: true
|
||
|
|
||
|
module Prometheus
|
||
|
class CreateDefaultAlertsWorker
|
||
|
include ApplicationWorker
|
||
|
|
||
|
feature_category :incident_management
|
||
|
urgency :high
|
||
|
idempotent!
|
||
|
|
||
|
def perform(project_id)
|
||
|
project = Project.find_by_id(project_id)
|
||
|
|
||
|
return unless project
|
||
|
|
||
|
result = Prometheus::CreateDefaultAlertsService.new(project: project).execute
|
||
|
|
||
|
log_info(result.message) if result.error?
|
||
|
end
|
||
|
|
||
|
private
|
||
|
|
||
|
def log_info(message)
|
||
|
logger.info(structured_payload(message: message))
|
||
|
end
|
||
|
end
|
||
|
end
|