rails_performance 1.0.0.beta2 → 1.0.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/rails_performance/rails_performance_controller.rb +34 -34
- data/app/views/rails_performance/layouts/rails_performance.html.erb +1 -1
- data/lib/rails_performance.rb +0 -2
- data/lib/rails_performance/data_source.rb +4 -4
- data/lib/rails_performance/gems/sidekiq_ext.rb +1 -1
- data/lib/rails_performance/models/request_record.rb +2 -2
- data/lib/rails_performance/reports/trace_report.rb +1 -1
- data/lib/rails_performance/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d95736df988ebe718c347259ae72fb5c33a10bd358c1ff5c459188d704ca89b6
|
4
|
+
data.tar.gz: 289ad1993e1a0cfb5f52143a5c45d37d898de0be6ef12101b7c2df6dde3d8966
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 841415e9db06b9cbc2fc820a349410b5d140b3bedb11731ba56d1359892f2226a732768cb908ebc1085bcca4bbd3653d1f49ebc3f6679aedb586df84a320c049
|
7
|
+
data.tar.gz: b8730fe25499f7303e28e900417ce759fc421adc95a2adab4142fac2bf7d30f90c847399fa442a1b1f0d42087f097ef74496f8d5531776221578100c889b94f8
|
@@ -6,20 +6,20 @@ module RailsPerformance
|
|
6
6
|
|
7
7
|
if RailsPerformance.enabled
|
8
8
|
def index
|
9
|
-
@datasource =
|
9
|
+
@datasource = RailsPerformance::DataSource.new(**prepare_query, type: :requests)
|
10
10
|
db = @datasource.db
|
11
11
|
|
12
|
-
@throughput_report_data =
|
13
|
-
@response_time_report_data =
|
12
|
+
@throughput_report_data = RailsPerformance::Reports::ThroughputReport.new(db).data
|
13
|
+
@response_time_report_data = RailsPerformance::Reports::ResponseTimeReport.new(db).data
|
14
14
|
end
|
15
15
|
|
16
16
|
def summary
|
17
|
-
@datasource =
|
17
|
+
@datasource = RailsPerformance::DataSource.new(**prepare_query, type: :requests)
|
18
18
|
db = @datasource.db
|
19
19
|
|
20
|
-
@throughput_report_data =
|
21
|
-
@response_time_report_data =
|
22
|
-
@data =
|
20
|
+
@throughput_report_data = RailsPerformance::Reports::ThroughputReport.new(db).data
|
21
|
+
@response_time_report_data = RailsPerformance::Reports::ResponseTimeReport.new(db).data
|
22
|
+
@data = RailsPerformance::Reports::BreakdownReport.new(db, title: "Requests").data
|
23
23
|
|
24
24
|
respond_to do |format|
|
25
25
|
format.js {}
|
@@ -28,8 +28,8 @@ module RailsPerformance
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def trace
|
31
|
-
@record =
|
32
|
-
@data =
|
31
|
+
@record = RailsPerformance::Models::RequestRecord.find_by(request_id: params[:id])
|
32
|
+
@data = RailsPerformance::Reports::TraceReport.new(request_id: params[:id]).data
|
33
33
|
respond_to do |format|
|
34
34
|
format.js {}
|
35
35
|
format.any { render plain: "Doesn't open in new window. Wait until full page load." }
|
@@ -37,65 +37,65 @@ module RailsPerformance
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def crashes
|
40
|
-
@datasource =
|
40
|
+
@datasource = RailsPerformance::DataSource.new(**prepare_query({status_eq: 500}), type: :requests)
|
41
41
|
db = @datasource.db
|
42
|
-
@data =
|
42
|
+
@data = RailsPerformance::Reports::CrashReport.new(db).data
|
43
43
|
end
|
44
44
|
|
45
45
|
def requests
|
46
|
-
@datasource =
|
46
|
+
@datasource = RailsPerformance::DataSource.new(**prepare_query, type: :requests)
|
47
47
|
db = @datasource.db
|
48
|
-
@data =
|
48
|
+
@data = RailsPerformance::Reports::RequestsReport.new(db, group: :controller_action_format, sort: :count).data
|
49
49
|
end
|
50
50
|
|
51
51
|
def recent
|
52
|
-
@datasource =
|
52
|
+
@datasource = RailsPerformance::DataSource.new(**prepare_query, type: :requests)
|
53
53
|
db = @datasource.db
|
54
|
-
@data =
|
54
|
+
@data = RailsPerformance::Reports::RecentRequestsReport.new(db).data
|
55
55
|
end
|
56
56
|
|
57
57
|
def sidekiq
|
58
|
-
@datasource =
|
58
|
+
@datasource = RailsPerformance::DataSource.new(**prepare_query, type: :sidekiq)
|
59
59
|
db = @datasource.db
|
60
|
-
@throughput_report_data =
|
61
|
-
@response_time_report_data =
|
62
|
-
@recent_report_data =
|
60
|
+
@throughput_report_data = RailsPerformance::Reports::ThroughputReport.new(db).data
|
61
|
+
@response_time_report_data = RailsPerformance::Reports::ResponseTimeReport.new(db).data
|
62
|
+
@recent_report_data = RailsPerformance::Reports::RecentRequestsReport.new(db).data
|
63
63
|
end
|
64
64
|
|
65
65
|
def delayed_job
|
66
|
-
@datasource =
|
66
|
+
@datasource = RailsPerformance::DataSource.new(**prepare_query, type: :delayed_job)
|
67
67
|
db = @datasource.db
|
68
|
-
@throughput_report_data =
|
69
|
-
@response_time_report_data =
|
70
|
-
@recent_report_data =
|
68
|
+
@throughput_report_data = RailsPerformance::Reports::ThroughputReport.new(db).data
|
69
|
+
@response_time_report_data = RailsPerformance::Reports::ResponseTimeReport.new(db).data
|
70
|
+
@recent_report_data = RailsPerformance::Reports::RecentRequestsReport.new(db).data
|
71
71
|
end
|
72
72
|
|
73
73
|
def custom
|
74
|
-
@datasource =
|
74
|
+
@datasource = RailsPerformance::DataSource.new(**prepare_query, type: :custom)
|
75
75
|
db = @datasource.db
|
76
|
-
@throughput_report_data =
|
77
|
-
@response_time_report_data =
|
78
|
-
@recent_report_data =
|
76
|
+
@throughput_report_data = RailsPerformance::Reports::ThroughputReport.new(db).data
|
77
|
+
@response_time_report_data = RailsPerformance::Reports::ResponseTimeReport.new(db).data
|
78
|
+
@recent_report_data = RailsPerformance::Reports::RecentRequestsReport.new(db).data
|
79
79
|
end
|
80
80
|
|
81
81
|
def grape
|
82
|
-
@datasource =
|
82
|
+
@datasource = RailsPerformance::DataSource.new(**prepare_query, type: :grape)
|
83
83
|
db = @datasource.db
|
84
|
-
@throughput_report_data =
|
85
|
-
@recent_report_data =
|
84
|
+
@throughput_report_data = RailsPerformance::Reports::ThroughputReport.new(db).data
|
85
|
+
@recent_report_data = RailsPerformance::Reports::RecentRequestsReport.new(db).data
|
86
86
|
end
|
87
87
|
|
88
88
|
def rake
|
89
|
-
@datasource =
|
89
|
+
@datasource = RailsPerformance::DataSource.new(**prepare_query, type: :rake)
|
90
90
|
db = @datasource.db
|
91
|
-
@throughput_report_data =
|
92
|
-
@recent_report_data =
|
91
|
+
@throughput_report_data = RailsPerformance::Reports::ThroughputReport.new(db).data
|
92
|
+
@recent_report_data = RailsPerformance::Reports::RecentRequestsReport.new(db).data
|
93
93
|
end
|
94
94
|
|
95
95
|
private
|
96
96
|
|
97
97
|
def prepare_query(query = params)
|
98
|
-
|
98
|
+
RailsPerformance::Rails::QueryBuilder.compose_from(query)
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
@@ -19,7 +19,7 @@
|
|
19
19
|
<%= yield %>
|
20
20
|
<div class="footer-box">
|
21
21
|
© Rails Performance <span class='red'><i class="fas fa-heart"></i></span> <%= link_to 'https://github.com/igorkasyanchuk/rails_performance', 'https://github.com/igorkasyanchuk/rails_performance', target: '_blank' %>
|
22
|
-
<div class="is-pulled-right">v.<%=
|
22
|
+
<div class="is-pulled-right">v.<%= RailsPerformance::VERSION %></div>
|
23
23
|
</div>
|
24
24
|
</div>
|
25
25
|
</section>
|
data/lib/rails_performance.rb
CHANGED
@@ -19,9 +19,9 @@ module RailsPerformance
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def db
|
22
|
-
result =
|
23
|
-
(
|
24
|
-
|
22
|
+
result = RailsPerformance::Models::Collection.new
|
23
|
+
(RailsPerformance::Utils.days + 1).times do |e|
|
24
|
+
RailsPerformance::DataSource.new(q: self.q.merge({ on: e.days.ago.to_date }), type: type).add_to(result)
|
25
25
|
end
|
26
26
|
result
|
27
27
|
end
|
@@ -30,7 +30,7 @@ module RailsPerformance
|
|
30
30
|
@q.keys == [:on]
|
31
31
|
end
|
32
32
|
|
33
|
-
def add_to(storage =
|
33
|
+
def add_to(storage = RailsPerformance::Models::Collection.new)
|
34
34
|
store do |record|
|
35
35
|
storage.add(record)
|
36
36
|
end
|
@@ -7,7 +7,7 @@ module RailsPerformance
|
|
7
7
|
|
8
8
|
def call(worker, msg, queue)
|
9
9
|
now = Time.now
|
10
|
-
record =
|
10
|
+
record = RailsPerformance::Models::SidekiqRecord.new(
|
11
11
|
enqueued_ati: msg['enqueued_at'].to_i,
|
12
12
|
datetimei: msg['created_at'].to_i,
|
13
13
|
jid: msg['jid'],
|
@@ -5,12 +5,12 @@ module RailsPerformance
|
|
5
5
|
attr_accessor :view_runtime, :db_runtime, :duration, :http_referer
|
6
6
|
|
7
7
|
def RequestRecord.find_by(request_id:)
|
8
|
-
keys, values =
|
8
|
+
keys, values = RailsPerformance::Utils.fetch_from_redis("performance|*|request_id|#{request_id}|*")
|
9
9
|
|
10
10
|
return nil if keys.blank?
|
11
11
|
return nil if values.blank?
|
12
12
|
|
13
|
-
|
13
|
+
RailsPerformance::Models::RequestRecord.from_db(keys[0], values[0])
|
14
14
|
end
|
15
15
|
|
16
16
|
# key = performance|
|