rails_performance 1.0.0.beta1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/app/controllers/rails_performance/rails_performance_controller.rb +34 -34
- data/app/views/rails_performance/layouts/rails_performance.html.erb +1 -1
- data/app/views/rails_performance/rails_performance/crashes.html.erb +6 -0
- data/app/views/rails_performance/stylesheets/style.css +4 -0
- data/lib/rails_performance.rb +2 -4
- data/lib/rails_performance/data_source.rb +10 -10
- data/lib/rails_performance/engine.rb +5 -1
- data/lib/rails_performance/gems/grape_ext.rb +1 -1
- data/lib/rails_performance/gems/sidekiq_ext.rb +1 -1
- data/lib/rails_performance/instrument/metrics_collector.rb +7 -1
- data/lib/rails_performance/models/custom_record.rb +1 -1
- data/lib/rails_performance/models/delayed_job_record.rb +1 -1
- data/lib/rails_performance/models/grape_record.rb +1 -1
- data/lib/rails_performance/models/rake_record.rb +1 -1
- data/lib/rails_performance/models/request_record.rb +19 -6
- data/lib/rails_performance/models/sidekiq_record.rb +1 -1
- data/lib/rails_performance/models/trace_record.rb +1 -1
- data/lib/rails_performance/reports/trace_report.rb +2 -2
- data/lib/rails_performance/version.rb +2 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5da13053dd45132a995aa83cd0a1514bf44bd0ca9acdac19898f2d23674171c8
|
4
|
+
data.tar.gz: de1e1dee044deed998dcaf3cc863301f7c3f4c732adb06efa98427f6797a79db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ed1e54a27941fba93ec958dce9eee09c926350e2906be2e91ff1458f751ed6bd37b29732f8ca0629137bd189796c3dc5e9f0eddab332e06512f76db1b6235a6
|
7
|
+
data.tar.gz: 49e036a7f777488c4c8cd90e0927b3969d2d5dd0d057ebdb8aa2b9e759a233ba0cd4652a2bcc0374517d101fa2f0ccbf12d6d856546b09f7ebfe9db51404a6f2
|
data/README.md
CHANGED
@@ -188,6 +188,8 @@ The idea of this gem grew from curriosity how many RPM my app receiving per day.
|
|
188
188
|
|
189
189
|
You are welcome to contribute. I've a big list of TODO.
|
190
190
|
|
191
|
+
If "schema" how records are stored i Redis is changed, and this is a breacking change, update: `RailsPerformance::SCHEMA` to a newer value.
|
192
|
+
|
191
193
|
## Big thanks to contributors
|
192
194
|
|
193
195
|
- https://github.com/synth
|
@@ -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>
|
@@ -9,6 +9,8 @@
|
|
9
9
|
<th data-sort="string">Method</th>
|
10
10
|
<th data-sort="string">Format</th>
|
11
11
|
<th data-sort="string">Path</th>
|
12
|
+
<th data-sort="string">Exception</th>
|
13
|
+
<th data-sort="string">Backtrace</th>
|
12
14
|
<th data-sort="string">Status</th>
|
13
15
|
<th data-sort="float">Duration</th>
|
14
16
|
<th data-sort="float">Views</th>
|
@@ -29,6 +31,10 @@
|
|
29
31
|
<td><%= e[:method] %></td>
|
30
32
|
<td><%= e[:format] %></td>
|
31
33
|
<td><%= link_to_path(e) %></td>
|
34
|
+
<td><%= e[:exception] %></td>
|
35
|
+
<td class="very-small-text">
|
36
|
+
<%= raw e[:backtrace]&.join("<br/>") %>
|
37
|
+
</td>
|
32
38
|
<td><%= status_tag e[:status] %></td>
|
33
39
|
<td class="nowrap"><%= ms e[:duration] %></td>
|
34
40
|
<td class="nowrap"><%= ms e[:view_runtime] %></td>
|
data/lib/rails_performance.rb
CHANGED
@@ -69,11 +69,11 @@ module RailsPerformance
|
|
69
69
|
mattr_accessor :skip
|
70
70
|
@@skip = false
|
71
71
|
|
72
|
-
def
|
72
|
+
def RailsPerformance.setup
|
73
73
|
yield(self)
|
74
74
|
end
|
75
75
|
|
76
|
-
def
|
76
|
+
def RailsPerformance.log(message)
|
77
77
|
return
|
78
78
|
|
79
79
|
if ::Rails.logger
|
@@ -86,8 +86,6 @@ module RailsPerformance
|
|
86
86
|
|
87
87
|
end
|
88
88
|
|
89
|
-
RP = RailsPerformance
|
90
|
-
|
91
89
|
require "rails_performance/engine"
|
92
90
|
|
93
91
|
require_relative './rails_performance/gems/custom_ext.rb'
|
@@ -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
|
@@ -52,17 +52,17 @@ module RailsPerformance
|
|
52
52
|
def query
|
53
53
|
case type
|
54
54
|
when :requests
|
55
|
-
"performance|*#{compile_requests_query}*|END|#{RailsPerformance::
|
55
|
+
"performance|*#{compile_requests_query}*|END|#{RailsPerformance::SCHEMA}"
|
56
56
|
when :sidekiq
|
57
|
-
"sidekiq|*#{compile_sidekiq_query}*|END|#{RailsPerformance::
|
57
|
+
"sidekiq|*#{compile_sidekiq_query}*|END|#{RailsPerformance::SCHEMA}"
|
58
58
|
when :delayed_job
|
59
|
-
"delayed_job|*#{compile_delayed_job_query}*|END|#{RailsPerformance::
|
59
|
+
"delayed_job|*#{compile_delayed_job_query}*|END|#{RailsPerformance::SCHEMA}"
|
60
60
|
when :grape
|
61
|
-
"grape|*#{compile_grape_query}*|END|#{RailsPerformance::
|
61
|
+
"grape|*#{compile_grape_query}*|END|#{RailsPerformance::SCHEMA}"
|
62
62
|
when :rake
|
63
|
-
"rake|*#{compile_rake_query}*|END|#{RailsPerformance::
|
63
|
+
"rake|*#{compile_rake_query}*|END|#{RailsPerformance::SCHEMA}"
|
64
64
|
when :custom
|
65
|
-
"custom|*#{compile_custom_query}*|END|#{RailsPerformance::
|
65
|
+
"custom|*#{compile_custom_query}*|END|#{RailsPerformance::SCHEMA}"
|
66
66
|
else
|
67
67
|
raise "wrong type for datasource query builder"
|
68
68
|
end
|
@@ -13,7 +13,11 @@ module RailsPerformance
|
|
13
13
|
if ::Rails::VERSION::MAJOR.to_i >= 5
|
14
14
|
app.middleware.insert_after ActionDispatch::Executor, RailsPerformance::Rails::Middleware
|
15
15
|
else
|
16
|
-
|
16
|
+
begin
|
17
|
+
app.middleware.insert_after ActionDispatch::Static, RailsPerformance::Rails::Middleware
|
18
|
+
rescue
|
19
|
+
app.middleware.insert_after Rack::SendFile, RailsPerformance::Rails::Middleware
|
20
|
+
end
|
17
21
|
end
|
18
22
|
# look like it works in reverse order?
|
19
23
|
app.middleware.insert_before RailsPerformance::Rails::Middleware, RailsPerformance::Rails::MiddlewareTraceStorerAndCleanup
|
@@ -7,7 +7,7 @@ module RailsPerformance
|
|
7
7
|
# TODO change to set
|
8
8
|
CurrentRequest.current.ignore.add(:performance)
|
9
9
|
|
10
|
-
now
|
10
|
+
now = Time.now
|
11
11
|
CurrentRequest.current.data ||= {}
|
12
12
|
CurrentRequest.current.record ||= RailsPerformance::Models::GrapeRecord.new(request_id: CurrentRequest.current.request_id)
|
13
13
|
CurrentRequest.current.record.datetimei ||= now.to_i
|
@@ -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'],
|
@@ -17,6 +17,8 @@ module RailsPerformance
|
|
17
17
|
|
18
18
|
def call(event_name, started, finished, event_id, payload)
|
19
19
|
return if RailsPerformance.skip
|
20
|
+
return if CurrentRequest.current.data
|
21
|
+
|
20
22
|
# TODO do we need this new?
|
21
23
|
event = ActiveSupport::Notifications::Event.new(event_name, started, finished, event_id, payload)
|
22
24
|
|
@@ -33,9 +35,13 @@ module RailsPerformance
|
|
33
35
|
path: event.payload[:path],
|
34
36
|
view_runtime: event.payload[:view_runtime],
|
35
37
|
db_runtime: event.payload[:db_runtime],
|
36
|
-
duration: event.duration
|
38
|
+
duration: event.duration,
|
39
|
+
exception: event.payload[:exception],
|
40
|
+
exception_object: event.payload[:exception_object]
|
37
41
|
}
|
38
42
|
|
43
|
+
# pass the record to Thread.current
|
44
|
+
# and saves later in middleware
|
39
45
|
CurrentRequest.current.data = record
|
40
46
|
end
|
41
47
|
end
|
@@ -38,7 +38,7 @@ module RailsPerformance
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def save
|
41
|
-
key = "custom|tag_name|#{tag_name}|namespace_name|#{namespace_name}|datetime|#{datetime}|datetimei|#{datetimei}|status|#{status}|END|#{RailsPerformance::
|
41
|
+
key = "custom|tag_name|#{tag_name}|namespace_name|#{namespace_name}|datetime|#{datetime}|datetimei|#{datetimei}|status|#{status}|END|#{RailsPerformance::SCHEMA}"
|
42
42
|
value = { duration: duration }
|
43
43
|
Utils.save_to_redis(key, value)
|
44
44
|
end
|
@@ -52,7 +52,7 @@ module RailsPerformance
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def save
|
55
|
-
key = "delayed_job|jid|#{jid}|datetime|#{datetime}|datetimei|#{datetimei}|source_type|#{source_type}|class_name|#{class_name}|method_name|#{method_name}|status|#{status}|END|#{RailsPerformance::
|
55
|
+
key = "delayed_job|jid|#{jid}|datetime|#{datetime}|datetimei|#{datetimei}|source_type|#{source_type}|class_name|#{class_name}|method_name|#{method_name}|status|#{status}|END|#{RailsPerformance::SCHEMA}"
|
56
56
|
value = { duration: duration }
|
57
57
|
Utils.save_to_redis(key, value)
|
58
58
|
end
|
@@ -50,7 +50,7 @@ module RailsPerformance
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def save
|
53
|
-
key = "grape|datetime|#{datetime}|datetimei|#{datetimei}|format|#{format}|path|#{path}|status|#{status}|method|#{method}|request_id|#{request_id}|END|#{RailsPerformance::
|
53
|
+
key = "grape|datetime|#{datetime}|datetimei|#{datetimei}|format|#{format}|path|#{path}|status|#{status}|method|#{method}|request_id|#{request_id}|END|#{RailsPerformance::SCHEMA}"
|
54
54
|
value = { "endpoint_render.grape" => endpoint_render_grape, "endpoint_run.grape" => endpoint_run_grape, "format_response.grape" => format_response_grape }
|
55
55
|
|
56
56
|
Utils.save_to_redis(key, value)
|
@@ -39,7 +39,7 @@ module RailsPerformance
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def save
|
42
|
-
key = "rake|task|#{task.to_json}|datetime|#{datetime}|datetimei|#{datetimei}|status|#{status}|END|#{RailsPerformance::
|
42
|
+
key = "rake|task|#{task.to_json}|datetime|#{datetime}|datetimei|#{datetimei}|status|#{status}|END|#{RailsPerformance::SCHEMA}"
|
43
43
|
value = { duration: duration }
|
44
44
|
Utils.save_to_redis(key, value)
|
45
45
|
end
|
@@ -3,14 +3,15 @@ module RailsPerformance
|
|
3
3
|
class RequestRecord < BaseRecord
|
4
4
|
attr_accessor :controller, :action, :format, :status, :datetime, :datetimei, :method, :path, :request_id, :json
|
5
5
|
attr_accessor :view_runtime, :db_runtime, :duration, :http_referer
|
6
|
+
attr_accessor :exception, :exception_object
|
6
7
|
|
7
8
|
def RequestRecord.find_by(request_id:)
|
8
|
-
keys, values =
|
9
|
+
keys, values = RailsPerformance::Utils.fetch_from_redis("performance|*|request_id|#{request_id}|*")
|
9
10
|
|
10
11
|
return nil if keys.blank?
|
11
12
|
return nil if values.blank?
|
12
13
|
|
13
|
-
|
14
|
+
RailsPerformance::Models::RequestRecord.from_db(keys[0], values[0])
|
14
15
|
end
|
15
16
|
|
16
17
|
# key = performance|
|
@@ -24,7 +25,7 @@ module RailsPerformance
|
|
24
25
|
# path|/|
|
25
26
|
# request_id|454545454545454545|
|
26
27
|
# END|1.0.0
|
27
|
-
# = {"view_runtime":
|
28
|
+
# = {"view_runtime":null,"db_runtime":0,"duration":27.329741000000002,"http_referer":null,"exception":"ZeroDivisionError divided by 0","backtrace":["/root/projects/rails_performance/test/dummy/app/controllers/account/site_controller.rb:17:in `/'","/root/projects/rails_performance/test/dummy/app/controllers/account/site_controller.rb:17:in `crash'","/usr/local/rvm/gems/ruby-2.6.3/gems/actionpack-6.1.3.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'"]}
|
28
29
|
# value = JSON
|
29
30
|
def RequestRecord.from_db(key, value)
|
30
31
|
items = key.split("|")
|
@@ -43,7 +44,7 @@ module RailsPerformance
|
|
43
44
|
)
|
44
45
|
end
|
45
46
|
|
46
|
-
def initialize(controller:, action:, format:, status:, datetime:, datetimei:, method:, path:, request_id:, view_runtime: nil, db_runtime: nil, duration: nil, http_referer: nil, json: '{}')
|
47
|
+
def initialize(controller:, action:, format:, status:, datetime:, datetimei:, method:, path:, request_id:, view_runtime: nil, db_runtime: nil, duration: nil, http_referer: nil, exception: nil, exception_object: nil, json: '{}')
|
47
48
|
@controller = controller
|
48
49
|
@action = action
|
49
50
|
@format = format
|
@@ -59,6 +60,9 @@ module RailsPerformance
|
|
59
60
|
@duration = duration
|
60
61
|
@http_referer = http_referer
|
61
62
|
|
63
|
+
@exception = Array.wrap(exception).compact.join(" ")
|
64
|
+
@exception_object = exception_object
|
65
|
+
|
62
66
|
@json = json
|
63
67
|
end
|
64
68
|
|
@@ -84,12 +88,21 @@ module RailsPerformance
|
|
84
88
|
duration: self.value['duration'],
|
85
89
|
db_runtime: self.value['db_runtime'],
|
86
90
|
view_runtime: self.value['view_runtime'],
|
91
|
+
exception: self.value['exception'],
|
92
|
+
backtrace: self.value['backtrace']
|
87
93
|
}
|
88
94
|
end
|
89
95
|
|
90
96
|
def save
|
91
|
-
|
92
|
-
|
97
|
+
key = "performance|controller|#{controller}|action|#{action}|format|#{format}|status|#{status}|datetime|#{datetime}|datetimei|#{datetimei}|method|#{method}|path|#{path}|request_id|#{request_id}|END|#{RailsPerformance::SCHEMA}"
|
98
|
+
value = {
|
99
|
+
view_runtime: view_runtime,
|
100
|
+
db_runtime: db_runtime,
|
101
|
+
duration: duration,
|
102
|
+
http_referer: http_referer,
|
103
|
+
}
|
104
|
+
value[:exception] = exception if exception.present?
|
105
|
+
value[:backtrace] = exception_object.backtrace.take(3) if exception_object
|
93
106
|
Utils.save_to_redis(key, value)
|
94
107
|
end
|
95
108
|
|
@@ -56,7 +56,7 @@ module RailsPerformance
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def save
|
59
|
-
key = "sidekiq|queue|#{queue}|worker|#{worker}|jid|#{jid}|datetime|#{datetime}|datetimei|#{datetimei}|enqueued_ati|#{enqueued_ati}|start_timei|#{start_timei}|status|#{status}|END|#{RailsPerformance::
|
59
|
+
key = "sidekiq|queue|#{queue}|worker|#{worker}|jid|#{jid}|datetime|#{datetime}|datetimei|#{datetimei}|enqueued_ati|#{enqueued_ati}|start_timei|#{start_timei}|status|#{status}|END|#{RailsPerformance::SCHEMA}"
|
60
60
|
value = { message: message, duration: duration }
|
61
61
|
Utils.save_to_redis(key, value)
|
62
62
|
end
|
@@ -11,7 +11,7 @@ module RailsPerformance
|
|
11
11
|
def save
|
12
12
|
return if value.empty?
|
13
13
|
|
14
|
-
Utils.save_to_redis("trace|#{request_id}|END|#{RailsPerformance::
|
14
|
+
Utils.save_to_redis("trace|#{request_id}|END|#{RailsPerformance::SCHEMA}", value, RailsPerformance::Reports::RecentRequestsReport::TIME_WINDOW.to_i)
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
@@ -8,8 +8,8 @@ module RailsPerformance
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def data
|
11
|
-
key = "trace|#{request_id}|END|#{RailsPerformance::
|
12
|
-
JSON.parse(
|
11
|
+
key = "trace|#{request_id}|END|#{RailsPerformance::SCHEMA}"
|
12
|
+
JSON.parse(RailsPerformance.redis.get(key).presence || '[]')
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_performance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Kasyanchuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -266,9 +266,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
266
266
|
version: '0'
|
267
267
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
268
268
|
requirements:
|
269
|
-
- - "
|
269
|
+
- - ">="
|
270
270
|
- !ruby/object:Gem::Version
|
271
|
-
version:
|
271
|
+
version: '0'
|
272
272
|
requirements: []
|
273
273
|
rubygems_version: 3.0.3
|
274
274
|
signing_key:
|