Welcome to mirror list, hosted at ThFree Co, Russian Federation.

create_default_alerts_worker.rb « prometheus « workers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2c4fefa9ecee71e59334e5e34d08dc4c3cec9661 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 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