diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
commit | e8d2c2579383897a1dd7f9debd359abe8ae8373d (patch) | |
tree | c42be41678c2586d49a75cabce89322082698334 /config/initializers/7_prometheus_metrics.rb | |
parent | fc845b37ec3a90aaa719975f607740c22ba6a113 (diff) |
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'config/initializers/7_prometheus_metrics.rb')
-rw-r--r-- | config/initializers/7_prometheus_metrics.rb | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/config/initializers/7_prometheus_metrics.rb b/config/initializers/7_prometheus_metrics.rb index 8dee21016f9..fc69ae7b077 100644 --- a/config/initializers/7_prometheus_metrics.rb +++ b/config/initializers/7_prometheus_metrics.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require 'prometheus/client' - # Keep separate directories for separate processes def prometheus_default_multiproc_dir return unless Rails.env.development? || Rails.env.test? @@ -15,14 +13,14 @@ def prometheus_default_multiproc_dir end end -Prometheus::Client.configure do |config| +::Prometheus::Client.configure do |config| config.logger = Gitlab::AppLogger config.initial_mmap_file_size = 4 * 1024 config.multiprocess_files_dir = ENV['prometheus_multiproc_dir'] || prometheus_default_multiproc_dir - config.pid_provider = Prometheus::PidProvider.method(:worker_id) + config.pid_provider = ::Prometheus::PidProvider.method(:worker_id) end Gitlab::Application.configure do |config| @@ -43,7 +41,7 @@ if !Rails.env.test? && Gitlab::Metrics.prometheus_metrics_enabled? # Thus, we order these events to run `reinitialize_on_pid_change` with `force: true` first. Gitlab::Cluster::LifecycleEvents.on_master_start do # Ensure that stale Prometheus metrics don't accumulate over time - Prometheus::CleanupMultiprocDirService.new.execute + ::Prometheus::CleanupMultiprocDirService.new.execute ::Prometheus::Client.reinitialize_on_pid_change(force: true) @@ -51,7 +49,7 @@ if !Rails.env.test? && Gitlab::Metrics.prometheus_metrics_enabled? Gitlab::Metrics::Samplers::PumaSampler.instance.start end - Gitlab::Metrics.gauge(:deployments, 'GitLab Version', {}, :max).set({ version: Gitlab::VERSION }, 1) + Gitlab::Metrics.gauge(:deployments, 'GitLab Version', {}, :max).set({ version: Gitlab::VERSION, revision: Gitlab.revision }, 1) unless Gitlab::Runtime.sidekiq? Gitlab::Metrics::RequestsRackMiddleware.initialize_metrics @@ -64,7 +62,7 @@ if !Rails.env.test? && Gitlab::Metrics.prometheus_metrics_enabled? end Gitlab::Cluster::LifecycleEvents.on_worker_start do - defined?(::Prometheus::Client.reinitialize_on_pid_change) && Prometheus::Client.reinitialize_on_pid_change + defined?(::Prometheus::Client.reinitialize_on_pid_change) && ::Prometheus::Client.reinitialize_on_pid_change Gitlab::Metrics::Samplers::RubySampler.initialize_instance.start Gitlab::Metrics::Samplers::DatabaseSampler.initialize_instance.start |