Commit 1da84266 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch '66889-reset-and-reinitialize-prometheus-client-on-master-start' into 'master'

Reinitialize metrics files on webserver master start

See merge request gitlab-org/gitlab!16623
parents 6dceb7bd ad396f9d
......@@ -326,7 +326,7 @@ group :metrics do
gem 'influxdb', '~> 0.2', require: false
# Prometheus
gem 'prometheus-client-mmap', '~> 0.9.9'
gem 'prometheus-client-mmap', '~> 0.9.10'
gem 'raindrops', '~> 0.18'
end
......
......@@ -715,7 +715,7 @@ GEM
parser
unparser
procto (0.0.3)
prometheus-client-mmap (0.9.9)
prometheus-client-mmap (0.9.10)
pry (0.11.3)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
......@@ -1250,7 +1250,7 @@ DEPENDENCIES
org-ruby (~> 0.9.12)
pg (~> 1.1)
premailer-rails (~> 1.9.7)
prometheus-client-mmap (~> 0.9.9)
prometheus-client-mmap (~> 0.9.10)
pry-byebug (~> 3.5.1)
pry-rails (~> 0.3.4)
puma (~> 3.12)
......
......@@ -47,10 +47,12 @@ if !Rails.env.test? && Gitlab::Metrics.prometheus_metrics_enabled?
end
Gitlab::Cluster::LifecycleEvents.on_master_start do
::Prometheus::Client.reinitialize_on_pid_change(force: true)
if defined?(::Unicorn)
Gitlab::Metrics::Samplers::UnicornSampler.initialize_instance(Settings.monitoring.unicorn_sampler_interval).start
Gitlab::Metrics::Samplers::UnicornSampler.instance(Settings.monitoring.unicorn_sampler_interval).start
elsif defined?(::Puma)
Gitlab::Metrics::Samplers::PumaSampler.initialize_instance(Settings.monitoring.puma_sampler_interval).start
Gitlab::Metrics::Samplers::PumaSampler.instance(Settings.monitoring.puma_sampler_interval).start
end
end
end
---
title: Reinitialize metrics files on webserver master process start
merge_request: 16623
author:
type: fixed
......@@ -10,8 +10,8 @@ module Gitlab
@instance
end
def self.instance
@instance ||= initialize_instance
def self.instance(*args)
@instance ||= initialize_instance(*args)
end
attr_reader :thread
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment