Commit 3c883759 authored by Jan Provaznik's avatar Jan Provaznik Committed by Kamil Trzciński

Start UnicornSampler in master process

Using `on_master_start` assures that the sampler is started in
master process and not in worker processes.
parent 5fb1de48
---
title: Make sure UnicornSampler is started only in master process.
merge_request: 30215
author:
type: fixed
......@@ -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
......
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