diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2019-07-02 17:05:56 +0000 |
---|---|---|
committer | Kamil TrzciĆski <ayufan@ayufan.eu> | 2019-07-02 17:05:56 +0000 |
commit | 3c883759c6ea9c1c60e69fd3e65fbf56b9e7af30 (patch) | |
tree | 08ea719ad67f532e17fd05dbc360b3a775508a8b /config | |
parent | 5fb1de48ccbd5f637b6a8d2d9889a480d7d359a2 (diff) | |
download | gitlab-ce-3c883759c6ea9c1c60e69fd3e65fbf56b9e7af30.tar.gz |
Start UnicornSampler in master process
Using `on_master_start` assures that the sampler is started in
master process and not in worker processes.
Diffstat (limited to 'config')
-rw-r--r-- | config/initializers/7_prometheus_metrics.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/config/initializers/7_prometheus_metrics.rb b/config/initializers/7_prometheus_metrics.rb index 54cdefc2a10..5db72141fcd 100644 --- a/config/initializers/7_prometheus_metrics.rb +++ b/config/initializers/7_prometheus_metrics.rb @@ -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 |