Method: SimpleApm::ApmController#index

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

#indexObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/controllers/simple_apm/apm_controller.rb', line 16

def index
  respond_to do |format|
    format.json do
      @slow_requests = SimpleApm::SlowRequest.list(params[:count]||200).map do |r|
        request = r.request
        [
          link_to(time_label(request.started), show_path(id: request.request_id)),
          link_to(request.action_name, action_info_path(action_name: request.action_name)),
          sec_str(request.during),
          sec_str(request.db_runtime),
          sec_str(request.view_runtime),
          request.host,
          request.remote_addr
        ]
      end
      render json: {data: @slow_requests}
    end
    format.html
  end
end