Class: Railswatch::RailswatchController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- Railswatch::RailswatchController
- Defined in:
- app/controllers/railswatch/railswatch_controller.rb
Instance Method Summary collapse
- #crashes ⇒ Object
- #custom ⇒ Object
- #delayed_job ⇒ Object
- #grape ⇒ Object
- #index ⇒ Object
- #rake ⇒ Object
- #recent ⇒ Object
- #requests ⇒ Object
- #resources ⇒ Object
- #sidekiq ⇒ Object
- #slow ⇒ Object
-
#summary ⇒ Object
rubocop:disable Metrics/MethodLength.
- #trace ⇒ Object
Methods inherited from BaseController
Methods included from Concerns::CsvExportable
Instance Method Details
#crashes ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 |
# File 'app/controllers/railswatch/railswatch_controller.rb', line 53 def crashes @datasource = Railswatch::DataSource.new(**prepare_query({ status_eq: 500 }), type: :requests) @table = Widgets::CrashesTable.new(@datasource) respond_to do |format| format.html format.csv do export_to_csv 'error_report', @table.data end end end |
#custom ⇒ Object
121 122 123 124 125 126 127 128 129 |
# File 'app/controllers/railswatch/railswatch_controller.rb', line 121 def custom @datasource = Railswatch::DataSource.new(**prepare_query(params), type: :custom) @widgets = [ Widgets::CustomEventsTable.new(@datasource), Widgets::ThroughputChart.new(@datasource, subtitle: 'Custom Events Throughput Report', legend: 'Events', units: 'events / minute'), Widgets::ResponseTimeChart.new(@datasource, subtitle: 'Average Execution Time') ] end |
#delayed_job ⇒ Object
111 112 113 114 115 116 117 118 119 |
# File 'app/controllers/railswatch/railswatch_controller.rb', line 111 def delayed_job @datasource = Railswatch::DataSource.new(**prepare_query(params), type: :delayed_job) @widgets = [ Widgets::ThroughputChart.new(@datasource, subtitle: 'Delayed::Job Workers Throughput Report', legend: 'Jobs', units: 'jobs / minute'), Widgets::ResponseTimeChart.new(@datasource, subtitle: 'Average Execution Time'), Widgets::DelayedJobTable.new(@datasource) ] end |
#grape ⇒ Object
131 132 133 134 135 136 137 |
# File 'app/controllers/railswatch/railswatch_controller.rb', line 131 def grape @datasource = Railswatch::DataSource.new(**prepare_query(params), type: :grape) @widgets = [ Widgets::ThroughputChart.new(@datasource, subtitle: 'Grape Throughput Report'), Widgets::GrapeRequestsTable.new(@datasource) ] end |
#index ⇒ Object
10 11 12 13 14 |
# File 'app/controllers/railswatch/railswatch_controller.rb', line 10 def index @datasource = Railswatch::DataSource.new(**prepare_query(params), type: :requests) assign_dashboard_reports(@datasource.db) @widgets = end |
#rake ⇒ Object
139 140 141 142 143 144 145 146 |
# File 'app/controllers/railswatch/railswatch_controller.rb', line 139 def rake @datasource = Railswatch::DataSource.new(**prepare_query(params), type: :rake) @widgets = [ Widgets::RakeTasksTable.new(@datasource), Widgets::ThroughputChart.new(@datasource, subtitle: 'Rake Throughput Report', legend: 'Tasks', units: 'tasks / minute') ] end |
#recent ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 |
# File 'app/controllers/railswatch/railswatch_controller.rb', line 77 def recent @datasource = Railswatch::DataSource.new(**prepare_query(params), type: :requests) @table = Widgets::RecentRequestsTable.new(@datasource) respond_to do |format| format.html format.csv do export_to_csv 'recent_requests_report', @table.data end end end |
#requests ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 |
# File 'app/controllers/railswatch/railswatch_controller.rb', line 65 def requests @datasource = Railswatch::DataSource.new(**prepare_query(params), type: :requests) @table = Widgets::RequestsTable.new(@datasource) respond_to do |format| format.html format.csv do export_to_csv 'requests_report', @table.data end end end |
#resources ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/railswatch/railswatch_controller.rb', line 16 def resources @datasource = Railswatch::DataSource.new( **prepare_query(params), type: :resources, days: Railswatch::Utils.days(Railswatch.system_monitor_duration) ) db = @datasource.db @resources_report = Railswatch::Reports::ResourcesReport.new(db) end |
#sidekiq ⇒ Object
101 102 103 104 105 106 107 108 109 |
# File 'app/controllers/railswatch/railswatch_controller.rb', line 101 def sidekiq @datasource = Railswatch::DataSource.new(**prepare_query(params), type: :sidekiq) @widgets = [ Widgets::ThroughputChart.new(@datasource, subtitle: 'Sidekiq Workers Throughput Report', legend: 'Jobs', units: 'jobs / minute'), Widgets::ResponseTimeChart.new(@datasource, subtitle: 'Average Execution Time'), Widgets::SidekiqJobsTable.new(@datasource) ] end |
#slow ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 |
# File 'app/controllers/railswatch/railswatch_controller.rb', line 89 def slow @datasource = Railswatch::DataSource.new(**prepare_query(params), type: :requests) @table = Widgets::SlowRequestsTable.new(@datasource) respond_to do |format| format.html format.csv do export_to_csv 'slow_requests_report', @table.data end end end |
#summary ⇒ Object
rubocop:disable Metrics/MethodLength
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/railswatch/railswatch_controller.rb', line 27 def summary # rubocop:disable Metrics/MethodLength @datasource = Railswatch::DataSource.new(**prepare_query(params), type: :requests) db = @datasource.db @throughput_report_data = Railswatch::Reports::ThroughputReport.new(db).data @response_time_report_data = Railswatch::Reports::ResponseTimeReport.new(db).data @data = Railswatch::Reports::BreakdownReport.new(db, title: 'Requests').data respond_to do |format| format.js format.any do render plain: "Doesn't open in new window. Wait until full page load." end end end |
#trace ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'app/controllers/railswatch/railswatch_controller.rb', line 42 def trace @record = Railswatch::Models::RequestRecord.find_by(request_id: params[:id]) @data = Railswatch::Reports::TraceReport.new(request_id: params[:id]).data respond_to do |format| format.js format.any do render plain: "Doesn't open in new window. Wait until full page load." end end end |