diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2019-05-29 12:27:44 +0000 |
---|---|---|
committer | Kamil TrzciĆski <ayufan@ayufan.eu> | 2019-05-29 12:27:44 +0000 |
commit | a5adc6a024012f727ac32c440bb42f4634ae0605 (patch) | |
tree | c02e44b595f6bdc67bc647234dfc4a19972aba6b /config | |
parent | d017d2d93d6afbd597cbf6683fcd7f90e88a05de (diff) | |
download | gitlab-ce-a5adc6a024012f727ac32c440bb42f4634ae0605.tar.gz |
Add Puma sampler
This sampler gathers Puma-specific metrics which can be used by
Prometheus then.
Diffstat (limited to 'config')
-rw-r--r-- | config/gitlab.yml.example | 2 | ||||
-rw-r--r-- | config/initializers/1_settings.rb | 1 | ||||
-rw-r--r-- | config/initializers/7_prometheus_metrics.rb | 8 |
3 files changed, 10 insertions, 1 deletions
diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index 23377b43f78..c83f569d885 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -752,6 +752,8 @@ production: &base monitoring: # Time between sampling of unicorn socket metrics, in seconds # unicorn_sampler_interval: 10 + # Time between sampling of Puma metrics, in seconds + # puma_sampler_interval: 5 # IP whitelist to access monitoring endpoints ip_whitelist: - 127.0.0.0/8 diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index d56bd7654af..0c8d94ccaed 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -491,6 +491,7 @@ Settings.webpack.dev_server['port'] ||= 3808 Settings['monitoring'] ||= Settingslogic.new({}) Settings.monitoring['ip_whitelist'] ||= ['127.0.0.1/8'] Settings.monitoring['unicorn_sampler_interval'] ||= 10 +Settings.monitoring['puma_sampler_interval'] ||= 5 Settings.monitoring['ruby_sampler_interval'] ||= 60 Settings.monitoring['sidekiq_exporter'] ||= Settingslogic.new({}) Settings.monitoring.sidekiq_exporter['enabled'] ||= false diff --git a/config/initializers/7_prometheus_metrics.rb b/config/initializers/7_prometheus_metrics.rb index 8052880cc3d..68f8487d377 100644 --- a/config/initializers/7_prometheus_metrics.rb +++ b/config/initializers/7_prometheus_metrics.rb @@ -29,12 +29,18 @@ 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 - unless Sidekiq.server? + 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::Metrics::Samplers::PumaSampler.initialize_instance(Settings.monitoring.puma_sampler_interval).start + end + end end Gitlab::Cluster::LifecycleEvents.on_master_restart do |