Merge branch 'unicorn-sampler-fix' into 'master'

Start UnicornSampler in master process

Closes #63830

See merge request gitlab-org/gitlab-ce!30215
This commit is contained in:
Kamil Trzciński 2019-07-02 17:05:57 +00:00
commit c6861b189b
2 changed files with 9 additions and 6 deletions

View file

@ -0,0 +1,5 @@
---
title: Make sure UnicornSampler is started only in master process.
merge_request: 30215
author:
type: fixed

View file

@ -29,15 +29,13 @@ if !Rails.env.test? && Gitlab::Metrics.prometheus_metrics_enabled?
Gitlab::Cluster::LifecycleEvents.on_worker_start do
defined?(::Prometheus::Client.reinitialize_on_pid_change) && Prometheus::Client.reinitialize_on_pid_change
if defined?(::Unicorn)
Gitlab::Metrics::Samplers::UnicornSampler.initialize_instance(Settings.monitoring.unicorn_sampler_interval).start
end
Gitlab::Metrics::Samplers::RubySampler.initialize_instance(Settings.monitoring.ruby_sampler_interval).start
end
if defined?(::Puma)
Gitlab::Cluster::LifecycleEvents.on_master_start do
Gitlab::Cluster::LifecycleEvents.on_master_start do
if defined?(::Unicorn)
Gitlab::Metrics::Samplers::UnicornSampler.initialize_instance(Settings.monitoring.unicorn_sampler_interval).start
elsif defined?(::Puma)
Gitlab::Metrics::Samplers::PumaSampler.initialize_instance(Settings.monitoring.puma_sampler_interval).start
end
end