Method: SimpleApm::ApmController#dashboard

Defined in:
app/controllers/simple_apm/apm_controller.rb

#dashboardObject



8
9
10
11
12
13
14
# File 'app/controllers/simple_apm/apm_controller.rb', line 8

def dashboard
  d = SimpleApm::RedisKey.query_date == Time.now.strftime('%Y-%m-%d') ? Time.now.strftime('%H:%M') : '23:50'
  data = SimpleApm::Hit.chart_data(0, d)
  @x_names = data.keys.sort
  @time_arr = @x_names.map{|n| data[n][:hits].to_i.zero? ? 0 : (data[n][:time].to_f/data[n][:hits].to_i).round(3) }
  @hits_arr = @x_names.map{|n| data[n][:hits] rescue 0}
end