diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-04 06:06:05 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-04 06:06:05 +0000 |
commit | 535d167d40638105527bc6c9a86f33d2ffd62743 (patch) | |
tree | 27c73f33497378f6bb84840223ce7d3fda42cc0a /config | |
parent | bee11af56deccfd13243cf5f31d42bd992404066 (diff) | |
download | gitlab-ce-535d167d40638105527bc6c9a86f33d2ffd62743.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'config')
-rw-r--r-- | config/gitlab.yml.example | 24 | ||||
-rw-r--r-- | config/initializers/1_settings.rb | 6 | ||||
-rw-r--r-- | config/initializers/7_prometheus_metrics.rb | 23 | ||||
-rw-r--r-- | config/puma.example.development.rb | 2 | ||||
-rw-r--r-- | config/puma.rb.example | 2 | ||||
-rw-r--r-- | config/unicorn.rb.example | 2 | ||||
-rw-r--r-- | config/unicorn.rb.example.development | 2 |
7 files changed, 54 insertions, 7 deletions
diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index 814ea551e19..3b7abdfe17e 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -1017,7 +1017,14 @@ production: &base sidekiq_exporter: # enabled: true # address: localhost - # port: 3807 + # port: 8082 + + # Web exporter is webserver built in to Unicorn/Puma to expose Prometheus metrics + # It runs alongside the `/metrics` endpoints to ease the publish of metrics + web_exporter: + # enabled: true + # address: localhost + # port: 8083 ## Prometheus settings # Do not modify these settings here. They should be modified in /etc/gitlab/gitlab.rb @@ -1061,6 +1068,21 @@ production: &base development: <<: *base + # We want to run web/sidekiq exporters for devs + # to catch errors from using them. + # + # We use random port to not block ability to run + # multiple instances of the service + monitoring: + sidekiq_exporter: + enabled: true + address: 127.0.0.1 + port: 0 + web_exporter: + enabled: true + address: 127.0.0.1 + port: 0 + test: <<: *base gravatar: diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index fbe6c21e53d..6feeab6ab6b 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -663,7 +663,11 @@ Settings.monitoring['ruby_sampler_interval'] ||= 60 Settings.monitoring['sidekiq_exporter'] ||= Settingslogic.new({}) Settings.monitoring.sidekiq_exporter['enabled'] ||= false Settings.monitoring.sidekiq_exporter['address'] ||= 'localhost' -Settings.monitoring.sidekiq_exporter['port'] ||= 3807 +Settings.monitoring.sidekiq_exporter['port'] ||= 8082 +Settings.monitoring['web_exporter'] ||= Settingslogic.new({}) +Settings.monitoring.web_exporter['enabled'] ||= false +Settings.monitoring.web_exporter['address'] ||= 'localhost' +Settings.monitoring.web_exporter['port'] ||= 8083 # # Testing settings diff --git a/config/initializers/7_prometheus_metrics.rb b/config/initializers/7_prometheus_metrics.rb index c55c14497b4..c5cd055f4ff 100644 --- a/config/initializers/7_prometheus_metrics.rb +++ b/config/initializers/7_prometheus_metrics.rb @@ -35,7 +35,7 @@ Sidekiq.configure_server do |config| # webserver metrics are cleaned up in config.ru: `warmup` block Prometheus::CleanupMultiprocDirService.new.execute - Gitlab::Metrics::SidekiqMetricsExporter.instance.start + Gitlab::Metrics::Exporter::SidekiqExporter.instance.start end end @@ -58,3 +58,24 @@ if !Rails.env.test? && Gitlab::Metrics.prometheus_metrics_enabled? Gitlab::Metrics::RequestsRackMiddleware.initialize_http_request_duration_seconds end end + +if defined?(::Unicorn) || defined?(::Puma) + Gitlab::Cluster::LifecycleEvents.on_master_start do + Gitlab::Metrics::Exporter::WebExporter.instance.start + end + + Gitlab::Cluster::LifecycleEvents.on_before_master_restart do + # We need to ensure that before we re-exec server + # we do stop the exporter + Gitlab::Metrics::Exporter::WebExporter.instance.stop + end + + Gitlab::Cluster::LifecycleEvents.on_worker_start do + # The `#close_on_exec=` takes effect only on `execve` + # but this does not happen for Ruby fork + # + # This does stop server, as it is running on master. + # However, ensures that we close the TCPSocket. + Gitlab::Metrics::Exporter::WebExporter.instance.stop + end +end diff --git a/config/puma.example.development.rb b/config/puma.example.development.rb index 9df24bf74e3..f23ccc23c9a 100644 --- a/config/puma.example.development.rb +++ b/config/puma.example.development.rb @@ -45,7 +45,7 @@ require_relative "/home/git/gitlab/lib/gitlab/cluster/lifecycle_events" on_restart do # Signal application hooks that we're about to restart - Gitlab::Cluster::LifecycleEvents.do_master_restart + Gitlab::Cluster::LifecycleEvents.do_before_master_restart end before_fork do diff --git a/config/puma.rb.example b/config/puma.rb.example index 6558dbc6cfe..10f255a87de 100644 --- a/config/puma.rb.example +++ b/config/puma.rb.example @@ -40,7 +40,7 @@ require_relative "/home/git/gitlab/lib/gitlab/cluster/puma_worker_killer_initial on_restart do # Signal application hooks that we're about to restart - Gitlab::Cluster::LifecycleEvents.do_master_restart + Gitlab::Cluster::LifecycleEvents.do_before_master_restart end before_fork do diff --git a/config/unicorn.rb.example b/config/unicorn.rb.example index 581fde84c95..9f13fac5cca 100644 --- a/config/unicorn.rb.example +++ b/config/unicorn.rb.example @@ -85,7 +85,7 @@ require_relative "/home/git/gitlab/lib/gitlab/cluster/lifecycle_events" before_exec do |server| # Signal application hooks that we're about to restart - Gitlab::Cluster::LifecycleEvents.do_master_restart + Gitlab::Cluster::LifecycleEvents.do_before_master_restart end run_once = true diff --git a/config/unicorn.rb.example.development b/config/unicorn.rb.example.development index 9a02d5f1007..92bb1c7344a 100644 --- a/config/unicorn.rb.example.development +++ b/config/unicorn.rb.example.development @@ -18,7 +18,7 @@ require_relative "/home/git/gitlab/lib/gitlab/cluster/lifecycle_events" before_exec do |server| # Signal application hooks that we're about to restart - Gitlab::Cluster::LifecycleEvents.do_master_restart + Gitlab::Cluster::LifecycleEvents.do_before_master_restart end run_once = true |