Class: VCAP::Varz

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

Instance Method Summary collapse

Constructor Details

#initialize(logger) ⇒ Varz

Returns a new instance of Varz.



17
18
19
# File 'lib/vcap/component.rb', line 17

def initialize(logger)
  @logger = logger
end

Instance Method Details

#call(env) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/vcap/component.rb', line 21

def call(env)
  @logger.debug "varz access"
  varz = Yajl::Encoder.encode(Component.updated_varz, :pretty => true, :terminator => "\n")
  [200, { 'Content-Type' => 'application/json', 'Content-Length' => varz.length.to_s }, varz]
rescue => e
  @logger.error "varz error #{e.inspect} #{e.backtrace.join("\n")}"
  raise e
end