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

global_metrics_update_service.rb « metrics « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 356de58ba2e3ac822037d6c826fa23bc2f930aef (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
# frozen_string_literal: true

module Metrics
  # Update metrics regarding GitLab instance wide
  #
  # Anything that is not specific to a machine, process, request or any other context
  # can be updated from this services.
  #
  # Examples of metrics that qualify:
  # * Global counters (instance users, instance projects...)
  # * State of settings stored in the database (whether a feature is active or not, tuning values...)
  #
  class GlobalMetricsUpdateService
    def execute
      return unless ::Gitlab::Metrics.prometheus_metrics_enabled?

      maintenance_mode_metric.set({}, (::Gitlab.maintenance_mode? ? 1 : 0))
    end

    def maintenance_mode_metric
      ::Gitlab::Metrics.gauge(:gitlab_maintenance_mode, 'Is GitLab Maintenance Mode enabled?')
    end
  end
end