Class: Dashboards::RequestChartsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/mission_control/servers/dashboards/request_charts_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/controllers/mission_control/servers/dashboards/request_charts_controller.rb', line 3

def show
  @project = MissionControl::Servers::Project.find_by(token: params[:project_id])
  @hostname = params[:hostname]
  recent_requests = @project.requests.recent_totals(@project, @hostname)
  @summary_hash = {
    sum_2xx: recent_requests.sum(:sum_2xx).to_i,
    sum_3xx: recent_requests.sum(:sum_3xx).to_i,
    sum_4xx: recent_requests.sum(:sum_4xx).to_i,
    sum_5xx: recent_requests.sum(:sum_5xx).to_i,
    unknown: recent_requests.sum(:unknown).to_i
  }
end