summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2017-11-07 16:52:55 +0900
committerShinya Maeda <shinya@gitlab.com>2017-11-07 16:52:55 +0900
commitdab3075a369c5966c6774d0c257833aebe9c447d (patch)
tree45ad09b605c925b90e56997baa781b82426c6ba4 /config
parentc6c9b37b1d1c9304b0eef530adb4d32178adae16 (diff)
parent435fd9d073fec75e987a367f0eb9379948f2bbc3 (diff)
downloadgitlab-ce-dab3075a369c5966c6774d0c257833aebe9c447d.tar.gz
Merge branch 'master' into 38464-k8s-apps
Diffstat (limited to 'config')
-rw-r--r--config/environments/test.rb1
-rw-r--r--config/initializers/1_settings.rb1
-rw-r--r--config/initializers/7_prometheus_metrics.rb18
-rw-r--r--config/initializers/8_metrics.rb11
4 files changed, 20 insertions, 11 deletions
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 1edb6fd39b8..d09e51e766a 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -1,6 +1,7 @@
Rails.application.configure do
# Make sure the middleware is inserted first in middleware chain
config.middleware.insert_before('ActionDispatch::Static', 'Gitlab::Testing::RequestBlockerMiddleware')
+ config.middleware.insert_before('ActionDispatch::Static', 'Gitlab::Testing::RequestInspectorMiddleware')
# Settings specified here will take precedence over those in config/application.rb
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 31839297523..e8f33593fe0 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|
@@ -19,3 +27,11 @@ Sidekiq.configure_server do |config|
Gitlab::Metrics::SidekiqMetricsExporter.instance.start
end
end
+
+if Gitlab::Metrics.prometheus_metrics_enabled?
+ unless Sidekiq.server?
+ 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
diff --git a/config/initializers/8_metrics.rb b/config/initializers/8_metrics.rb
index 2d8704622b6..7ef594836d6 100644
--- a/config/initializers/8_metrics.rb
+++ b/config/initializers/8_metrics.rb
@@ -77,7 +77,6 @@ def instrument_classes(instrumentation)
instrumentation.instrument_instance_methods(Banzai::ObjectRenderer)
instrumentation.instrument_instance_methods(Banzai::Redactor)
- instrumentation.instrument_methods(Banzai::NoteRenderer)
[Issuable, Mentionable, Participable].each do |klass|
instrumentation.instrument_instance_methods(klass)
@@ -116,17 +115,9 @@ def instrument_classes(instrumentation)
# Needed for https://gitlab.com/gitlab-org/gitlab-ce/issues/30224#note_32306159
instrumentation.instrument_instance_method(MergeRequestDiff, :load_commits)
-
- # Needed for https://gitlab.com/gitlab-org/gitlab-ce/issues/36061
- instrumentation.instrument_instance_method(MergeRequest, :ensure_ref_fetched)
- instrumentation.instrument_instance_method(MergeRequest, :fetch_ref)
end
# rubocop:enable Metrics/AbcSize
-unless Sidekiq.server?
- Gitlab::Metrics::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)
@@ -192,7 +183,7 @@ if Gitlab::Metrics.enabled?
GC::Profiler.enable
- Gitlab::Metrics::InfluxSampler.initialize_instance.start
+ Gitlab::Metrics::Samplers::InfluxSampler.initialize_instance.start
module TrackNewRedisConnections
def connect(*args)