diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-07 15:05:59 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-07 15:05:59 +0000 |
commit | 31040b5bfe48f8d73830f473513164427522b3a6 (patch) | |
tree | 6301b395ad45d7a0f84aa0f9c31373889208d09b /app/controllers/health_controller.rb | |
parent | 185f428fa5e6123ffa0f29e307523da138e7b028 (diff) | |
download | gitlab-ce-31040b5bfe48f8d73830f473513164427522b3a6.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/health_controller.rb')
-rw-r--r-- | app/controllers/health_controller.rb | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/app/controllers/health_controller.rb b/app/controllers/health_controller.rb index 99840e40af1..d88ec06a18b 100644 --- a/app/controllers/health_controller.rb +++ b/app/controllers/health_controller.rb @@ -5,23 +5,21 @@ class HealthController < ActionController::Base include RequiresWhitelistedMonitoringClient def readiness - results = checks.flat_map(&:readiness) - success = results.all?(&:success) - - # disable static error pages at the gitlab-workhorse level, we want to see this error response even in production - headers["X-GitLab-Custom-Error"] = 1 unless success - - response = results.map { |result| [result.name, result.payload] }.to_h - render json: response, status: success ? :ok : :service_unavailable + render_probe(::Gitlab::HealthChecks::Probes::Readiness) end def liveness - render json: { status: 'ok' }, status: :ok + render_probe(::Gitlab::HealthChecks::Probes::Liveness) end private - def checks - ::Gitlab::HealthChecks::CHECKS + def render_probe(probe_class) + result = probe_class.new.execute + + # disable static error pages at the gitlab-workhorse level, we want to see this error response even in production + headers["X-GitLab-Custom-Error"] = 1 unless result.success? + + render json: result.json, status: result.http_status end end |