Method: VMC::Client#app_stats

Defined in:
lib/vmc/client.rb

#app_stats(name) ⇒ Object



126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/vmc/client.rb', line 126

def app_stats(name)
  
  stats_raw = json_get(path(VMC::APPS_PATH, name, "stats"))
  stats = []
  stats_raw.each_pair do |k, entry|
    # Skip entries with no stats
    next unless entry[:stats]
    entry[:instance] = k.to_s.to_i
    entry[:state] = entry[:state].to_sym if entry[:state]
    stats << entry
  end
  stats.sort { |a,b| a[:instance] - b[:instance] }
end