Class: RailsPerformance::RailsPerformanceController

Inherits:
BaseController
  • Object
show all
Includes:
ApplicationHelper
Defined in:
app/controllers/rails_performance/rails_performance_controller.rb

Instance Method Summary collapse

Methods included from ApplicationHelper

#active?, #duraction_alert_class, #extract_duration, #format_datetime, #icon, #insert_css_file, #insert_js_file, #link_to_path, #ms, #report_name, #round_it, #short_path, #status_tag

Instance Method Details

#crashesObject



48
49
50
51
52
53
# File 'app/controllers/rails_performance/rails_performance_controller.rb', line 48

def crashes
  @datasource   = RP::DataSource.new(**prepare_query({status_eq: 500}), type: :requests, klass: RP::Models::Record)
  db            = @datasource.db
  @report       = RP::Reports::CrashReport.new(db)
  @data         = @report.data
end

#indexObject



8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/rails_performance/rails_performance_controller.rb', line 8

def index
  @datasource                = RP::DataSource.new(**prepare_query, type: :requests, klass: RP::Models::Record)
  db                         = @datasource.db

  @throughput_report         = RP::Reports::ThroughputReport.new(db)
  @throughput_report_data    = @throughput_report.data

  @response_time_report      = RP::Reports::ResponseTimeReport.new(db)
  @response_time_report_data = @response_time_report.data
end

#jobsObject



69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'app/controllers/rails_performance/rails_performance_controller.rb', line 69

def jobs
  @datasource                = RP::DataSource.new(**prepare_query, type: :jobs, klass: RP::Models::JobRecord)
  db                         = @datasource.db

  @throughput_report         = RP::Reports::ThroughputReport.new(db)
  @throughput_report_data    = @throughput_report.data

  @response_time_report      = RP::Reports::ResponseTimeReport.new(db)
  @response_time_report_data = @response_time_report.data

  @recent_report             = RP::Reports::RecentRequestsReport.new(db)
  @recent_report_data        = @recent_report.data(:jobs)
end

#recentObject



62
63
64
65
66
67
# File 'app/controllers/rails_performance/rails_performance_controller.rb', line 62

def recent
  @datasource = RP::DataSource.new(**prepare_query, type: :requests, klass: RP::Models::Record)
  db          = @datasource.db
  @report     = RP::Reports::RecentRequestsReport.new(db)
  @data       = @report.data
end

#requestsObject



55
56
57
58
59
60
# File 'app/controllers/rails_performance/rails_performance_controller.rb', line 55

def requests
  @datasource = RP::DataSource.new(**prepare_query, type: :requests, klass: RP::Models::Record)
  db          = @datasource.db
  @report     = RP::Reports::RequestsReport.new(db, group: :controller_action_format, sort: :count)
  @data       = @report.data
end

#summaryObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/rails_performance/rails_performance_controller.rb', line 19

def summary
  @datasource                = RP::DataSource.new(**prepare_query, type: :requests, klass: RP::Models::Record)
  db                         = @datasource.db

  @throughput_report         = RP::Reports::ThroughputReport.new(db)
  @throughput_report_data    = @throughput_report.data

  @response_time_report      = RP::Reports::ResponseTimeReport.new(db)
  @response_time_report_data = @response_time_report.data

  @report                    = RP::Reports::BreakdownReport.new(db, title: "Requests")
  @data                      = @report.data

  respond_to do |format|
    format.js {}
    format.any { render plain: "Doesn't open in new window. Wait until full page load." }
  end
end

#traceObject



38
39
40
41
42
43
44
45
46
# File 'app/controllers/rails_performance/rails_performance_controller.rb', line 38

def trace
  @record = RP::Models::Record.find_by(request_id: params[:id])
  @report = RP::Reports::TraceReport.new(request_id: params[:id])
  @data   = @report.data
  respond_to do |format|
    format.js {}
    format.any { render plain: "Doesn't open in new window. Wait until full page load." }
  end
end