Skip to content

Instantly share code, notes, and snippets.

@Ebtoulson
Created April 14, 2014 15:33
Show Gist options
  • Save Ebtoulson/10658837 to your computer and use it in GitHub Desktop.
Save Ebtoulson/10658837 to your computer and use it in GitHub Desktop.
class HealthCheck
class << self
def check!
status = {
service: service_working?,
db: db_connected?
}
[status.values.all?, status]
rescue e
[false, :exception => e.message]
end
end
end
get '/health_check' do
healthy, details = HealthCheck.check!
[
healthy ? 200 : 500,
{"Content-Type": "application/json"},
details.to_json
]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment