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

check_prometheus_health_worker.rb « applications « clusters « workers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4f85c5c5b7a515d32f395b15c3e7a1594e8d4f4a (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
28
29
30
31
32
33
# frozen_string_literal: true

module Clusters
  module Applications
    class CheckPrometheusHealthWorker
      include ApplicationWorker

      data_consistency :always

      # rubocop:disable Scalability/CronWorkerContext
      # This worker does not perform work scoped to a context
      include CronjobQueue
      # rubocop:enable Scalability/CronWorkerContext

      queue_namespace :incident_management
      feature_category :incident_management
      urgency :low

      idempotent!
      worker_has_external_dependencies!

      def perform
        demo_project_ids = Gitlab::Monitor::DemoProjects.primary_keys

        clusters = Clusters::Cluster.with_application_prometheus
          .with_project_http_integrations(demo_project_ids)

        # Move to a seperate worker with scoped context if expanded to do work on customer projects
        clusters.each { |cluster| Clusters::Applications::PrometheusHealthCheckService.new(cluster).execute }
      end
    end
  end
end