diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-09-06 02:26:31 +0300 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-11-02 20:11:43 +0300 |
commit | c97dc61a9e3e203bc7a3315dd6828eda320b4323 (patch) | |
tree | 4f15773b218db49072f7089c477961c44ef05f20 /config/initializers | |
parent | 3cc28601f37c11e444362495f27d39aee3d7aaca (diff) |
Cleanup transaction metrics
Diffstat (limited to 'config/initializers')
-rw-r--r-- | config/initializers/1_settings.rb | 1 | ||||
-rw-r--r-- | config/initializers/7_prometheus_metrics.rb | 17 | ||||
-rw-r--r-- | config/initializers/8_metrics.rb | 4 |
3 files changed, 14 insertions, 8 deletions
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index 12694f8016f..d1156b0c8a8 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -535,6 +535,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['ruby_sampler_interval'] ||= 60 Settings.monitoring['sidekiq_exporter'] ||= Settingslogic.new({}) Settings.monitoring.sidekiq_exporter['enabled'] ||= false Settings.monitoring.sidekiq_exporter['address'] ||= 'localhost' diff --git a/config/initializers/7_prometheus_metrics.rb b/config/initializers/7_prometheus_metrics.rb index 4f9e4e1b229..135448d5a89 100644 --- a/config/initializers/7_prometheus_metrics.rb +++ b/config/initializers/7_prometheus_metrics.rb @@ -11,7 +11,15 @@ Prometheus::Client.configure do |config| config.multiprocess_files_dir ||= Rails.root.join('tmp/prometheus_multiproc_dir') end - config.pid_provider = Prometheus::Client::Support::Unicorn.method(:worker_pid_provider) + config.pid_provider = -> do + wid = Prometheus::Client::Support::Unicorn.worker_id + wid = Process.pid if wid.nil? + if wid.nil? + "process_pid_#{Process.pid}" + else + "worker_id_#{wid}" + end + end end Sidekiq.configure_server do |config| @@ -20,6 +28,7 @@ Sidekiq.configure_server do |config| end end -# if Gitlab::Metrics.prometheus_metrics_enabled? -Gitlab::Metrics::Samplers::RubySampler.initialize_instance(60.second).start -# end +if Gitlab::Metrics.prometheus_metrics_enabled? + Gitlab::Metrics::Samplers::UnicornSampler.initialize_instance(Settings.monitoring.unicorn_sampler_interval).start + Gitlab::Metrics::Samplers::RubySampler.initialize_instance(Settings.monitoring.ruby_sampler_interval).start +end diff --git a/config/initializers/8_metrics.rb b/config/initializers/8_metrics.rb index e1ca67b3b78..6c0ff5aceed 100644 --- a/config/initializers/8_metrics.rb +++ b/config/initializers/8_metrics.rb @@ -123,10 +123,6 @@ def instrument_classes(instrumentation) end # rubocop:enable Metrics/AbcSize -unless Sidekiq.server? - Gitlab::Metrics::Samplers::UnicornSampler.initialize_instance(Settings.monitoring.unicorn_sampler_interval).start -end - Gitlab::Application.configure do |config| # 0 should be Sentry to catch errors in this middleware config.middleware.insert(1, Gitlab::Metrics::RequestsRackMiddleware) |