Class: VCAP::Healthz

Inherits:
Object
  • Object
show all
Defined in:
lib/vcap/component.rb

Instance Method Summary collapse

Constructor Details

#initialize(logger) ⇒ Healthz

Returns a new instance of Healthz.



32
33
34
# File 'lib/vcap/component.rb', line 32

def initialize(logger)
  @logger = logger
end

Instance Method Details

#call(env) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/vcap/component.rb', line 36

def call(env)
  @logger.debug "healthz access"
  healthz = Component.updated_healthz
  [200, { 'Content-Type' => 'application/json', 'Content-Length' => healthz.length.to_s }, healthz]
rescue => e
  @logger.error "healthz error #{e.inspect} #{e.backtrace.join("\n")}"
  raise e
end