rails_performance 1.2.0.alpha5 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -3
- data/app/helpers/rails_performance/application_helper.rb +1 -5
- data/app/views/rails_performance/rails_performance/_recent_row.html.erb +1 -1
- data/app/views/rails_performance/rails_performance/_summary.html.erb +4 -2
- data/app/views/rails_performance/rails_performance/crashes.html.erb +2 -0
- data/app/views/rails_performance/rails_performance/recent.html.erb +1 -1
- data/app/views/rails_performance/rails_performance/slow.html.erb +1 -1
- data/app/views/rails_performance/stylesheets/style.css +10 -0
- data/lib/rails_performance/reports/base_report.rb +1 -11
- data/lib/rails_performance/reports/throughput_report.rb +0 -8
- data/lib/rails_performance/version.rb +1 -1
- data/lib/rails_performance.rb +1 -0
- metadata +34 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b7357f736b95447fdaaf95de2db6042794148a17b87ef517b8a8b7bda19212f
|
4
|
+
data.tar.gz: 189eb4cb2151d20e00f18494768299b5ff8060c41e086db752af9360343f94d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 075f60cbc47d2df3baa13259cae71230a3395afc9095f6cd48d6cd5fd15f1f15619c12c0ba5dbcb296fdc2ab6f9b4c89888db836a97066c2b2157f4f14e01058
|
7
|
+
data.tar.gz: 1289acb796e6fc71a98fc36ceed9dc6cc709253725d73cd2be58220e265f05e8db34c977222d8f67e8cfe130a376ebbfe061221c8e6cc541a51ba9239273fd43
|
data/README.md
CHANGED
@@ -46,7 +46,7 @@ Just don't forget to protect performance dashboard with http basic auth or check
|
|
46
46
|
5. Tune the configuration and deploy to production
|
47
47
|
```
|
48
48
|
|
49
|
-
Default
|
49
|
+
Default configuration is listed below. But you can override it.
|
50
50
|
|
51
51
|
Create `config/initializers/rails_performance.rb` in your app:
|
52
52
|
|
@@ -196,7 +196,7 @@ For UI changes you need to use Bulma CSS (https://bulma.io/documentation).
|
|
196
196
|
|
197
197
|
## Why
|
198
198
|
|
199
|
-
The idea of this gem grew from
|
199
|
+
The idea of this gem grew from curiosity how many RPM my app receiving per day. Later it evolved to something more powerful.
|
200
200
|
|
201
201
|
## TODO
|
202
202
|
|
@@ -227,7 +227,7 @@ The idea of this gem grew from curriosity how many RPM my app receiving per day.
|
|
227
227
|
|
228
228
|
You are welcome to contribute. I've a big list of TODO.
|
229
229
|
|
230
|
-
If "schema" how records are stored i Redis is changed, and this is a
|
230
|
+
If "schema" how records are stored i Redis is changed, and this is a breaking change, update: `RailsPerformance::SCHEMA` to a newer value.
|
231
231
|
|
232
232
|
## Big thanks to contributors
|
233
233
|
|
@@ -239,6 +239,8 @@ If "schema" how records are stored i Redis is changed, and this is a breacking c
|
|
239
239
|
- https://github.com/haffla
|
240
240
|
- https://github.com/D1ceWard
|
241
241
|
- https://github.com/carl-printreleaf
|
242
|
+
- https://github.com/langalex
|
243
|
+
- https://github.com/olleolleolle
|
242
244
|
|
243
245
|
[<img src="https://opensource-heroes.com/svg/embed/igorkasyanchuk/rails_performance"
|
244
246
|
/>](https://opensource-heroes.com/r/igorkasyanchuk/rails_performance)
|
@@ -95,17 +95,13 @@ module RailsPerformance
|
|
95
95
|
def bot_icon(user_agent)
|
96
96
|
return nil if user_agent.blank?
|
97
97
|
|
98
|
-
# TODO: clean this up
|
99
|
-
# user_agent = "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/W.X.Y.Z Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
|
100
|
-
|
101
98
|
browser = Browser.new(user_agent)
|
102
|
-
|
103
99
|
if browser.bot?
|
104
100
|
content_tag(:span, class: "user-agent-icon", title: browser.bot&.name) do
|
105
101
|
icon("bot")
|
106
102
|
end
|
107
103
|
else
|
108
|
-
content_tag(:span, class: "user-agent-icon user-agent-icon-user") do
|
104
|
+
content_tag(:span, class: "user-agent-icon user-agent-icon-user", title: "Real User") do
|
109
105
|
icon("user")
|
110
106
|
end
|
111
107
|
end
|
@@ -7,13 +7,13 @@
|
|
7
7
|
<% end %>
|
8
8
|
</td>
|
9
9
|
<td><%= format_datetime e[:datetime] %></td>
|
10
|
-
<td><%= bot_icon e["user_agent"] %></td>
|
11
10
|
<td>
|
12
11
|
<% controller_action_info = e[:controller] + '#' + e[:action]%>
|
13
12
|
<%= link_to truncate(controller_action_info, length: 40), rails_performance.rails_performance_summary_path({controller_eq: e[:controller], action_eq: e[:action]}), remote: true, title: controller_action_info %>
|
14
13
|
</td>
|
15
14
|
<td><%= e[:method] %></td>
|
16
15
|
<td><%= e[:format] %></td>
|
16
|
+
<td><%= bot_icon e["user_agent"] %></td>
|
17
17
|
<td><%= link_to_path(e) %></td>
|
18
18
|
<td><%= status_tag e[:status] %></td>
|
19
19
|
<td class="nowrap"><%= ms e[:duration] %></td>
|
@@ -5,11 +5,12 @@
|
|
5
5
|
<div id="response_time_report_chart_mini" class="chart_mini"></div>
|
6
6
|
|
7
7
|
<h2 class="subtitle"><%= title %></h2>
|
8
|
-
<table class="table is-fullwidth is-hoverable is-narrow is-size-
|
8
|
+
<table class="table is-fullwidth is-hoverable is-narrow is-size-9">
|
9
9
|
<thead>
|
10
10
|
<tr>
|
11
11
|
<th data-sort="string">Datetime</th>
|
12
12
|
<th data-sort="string">Method</th>
|
13
|
+
<th></th>
|
13
14
|
<th data-sort="string">Path</th>
|
14
15
|
<th data-sort="string">Format</th>
|
15
16
|
<th data-sort="int">Status</th>
|
@@ -23,6 +24,7 @@
|
|
23
24
|
<tr>
|
24
25
|
<td><%= format_datetime e[:datetime] %></td>
|
25
26
|
<td><%= e[:method] %></td>
|
27
|
+
<td><%= bot_icon e["user_agent"] %></td>
|
26
28
|
<td><%= link_to_path(e) %></td>
|
27
29
|
<td><%= e[:format] %></td>
|
28
30
|
<td><%= status_tag e[:status] %></td>
|
@@ -32,4 +34,4 @@
|
|
32
34
|
</tr>
|
33
35
|
<% end %>
|
34
36
|
</tbody>
|
35
|
-
</table>
|
37
|
+
</table>
|
@@ -8,6 +8,7 @@
|
|
8
8
|
<th data-sort="string">Controller#action</th>
|
9
9
|
<th data-sort="string">Method</th>
|
10
10
|
<th data-sort="string">Format</th>
|
11
|
+
<th></th>
|
11
12
|
<th data-sort="string">Path</th>
|
12
13
|
<th data-sort="string">Exception</th>
|
13
14
|
<th data-sort="string">Backtrace</th>
|
@@ -30,6 +31,7 @@
|
|
30
31
|
<td><%= link_to e[:controller] + '#' + e[:action], rails_performance.rails_performance_summary_path({controller_eq: e[:controller], action_eq: e[:action]}), remote: true %></td>
|
31
32
|
<td><%= e[:method] %></td>
|
32
33
|
<td><%= e[:format] %></td>
|
34
|
+
<td><%= bot_icon e["user_agent"] %></td>
|
33
35
|
<td><%= link_to_path(e) %></td>
|
34
36
|
<td><%= e[:exception] %></td>
|
35
37
|
<td class="very-small-text">
|
@@ -19,10 +19,10 @@
|
|
19
19
|
<tr>
|
20
20
|
<th data-sort="string"></th>
|
21
21
|
<th data-sort="string">Datetime</th>
|
22
|
-
<th></th>
|
23
22
|
<th data-sort="string">Controller#action</th>
|
24
23
|
<th data-sort="string">Method</th>
|
25
24
|
<th data-sort="string">Format</th>
|
25
|
+
<th></th>
|
26
26
|
<th data-sort="string">Path</th>
|
27
27
|
<th data-sort="string">Status</th>
|
28
28
|
<th data-sort="float">Duration</th>
|
@@ -13,10 +13,10 @@
|
|
13
13
|
<tr>
|
14
14
|
<th data-sort="string"></th>
|
15
15
|
<th data-sort="string">Datetime</th>
|
16
|
-
<th></th>
|
17
16
|
<th data-sort="string">Controller#action</th>
|
18
17
|
<th data-sort="string">Method</th>
|
19
18
|
<th data-sort="string">Format</th>
|
19
|
+
<th></th>
|
20
20
|
<th data-sort="string">Path</th>
|
21
21
|
<th data-sort="string">Status</th>
|
22
22
|
<th data-sort="float">Duration</th>
|
@@ -105,3 +105,13 @@ table th[data-sort] {
|
|
105
105
|
#autoupdate_label {
|
106
106
|
cursor: pointer;
|
107
107
|
}
|
108
|
+
|
109
|
+
.is-size-8, .is-size-8 * {
|
110
|
+
font-size: 10px !important;
|
111
|
+
line-height: 20px !important;
|
112
|
+
}
|
113
|
+
|
114
|
+
.is-size-9, .is-size-9 * {
|
115
|
+
font-size: 7px !important;
|
116
|
+
line-height: 20px !important;
|
117
|
+
}
|
@@ -39,25 +39,15 @@ module RailsPerformance
|
|
39
39
|
@data = []
|
40
40
|
all = {}
|
41
41
|
|
42
|
-
# puts "current: #{current}"
|
43
|
-
# puts "stop: #{stop}"
|
44
|
-
|
45
42
|
# read current values
|
46
43
|
db.group_by(group).each do |(k, v)|
|
47
44
|
yield(all, k, v)
|
48
45
|
end
|
49
46
|
|
50
|
-
# puts '----'
|
51
|
-
# puts all
|
52
|
-
# puts '----'
|
53
|
-
# puts "offset: #{offset}"
|
54
|
-
# puts '======='
|
55
|
-
|
56
47
|
# add blank columns
|
57
48
|
while current <= stop
|
58
|
-
key
|
49
|
+
key = (current).strftime(RailsPerformance::FORMAT)
|
59
50
|
views = all[key].presence || 0
|
60
|
-
# puts "#{key} -> #{views}"
|
61
51
|
@data << [(current.to_i + offset) * 1000, views.round(2)]
|
62
52
|
current += 1.minute
|
63
53
|
end
|
@@ -6,14 +6,6 @@ module RailsPerformance
|
|
6
6
|
@group ||= :datetime
|
7
7
|
end
|
8
8
|
|
9
|
-
# def prepare_query(query = {})
|
10
|
-
# RailsPerformance::Rails::QueryBuilder.compose_from({})
|
11
|
-
# end
|
12
|
-
# @datasource = RailsPerformance::DataSource.new(**prepare_query({}), type: :requests)
|
13
|
-
# db = @datasource.db
|
14
|
-
# RailsPerformance::Reports::ThroughputReport.new(db).data
|
15
|
-
# Time.at(RailsPerformance::Reports::ThroughputReport.new(db).data.last[0] / 1000)
|
16
|
-
|
17
9
|
def data
|
18
10
|
calculate_data do |all, k, v|
|
19
11
|
all[k] = v.count
|
data/lib/rails_performance.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "redis"
|
2
2
|
require "redis-namespace"
|
3
3
|
require "browser"
|
4
|
+
require 'active_support/core_ext/integer'
|
4
5
|
require_relative "./rails_performance/version.rb"
|
5
6
|
require_relative "rails_performance/rails/query_builder.rb"
|
6
7
|
require_relative "rails_performance/rails/middleware.rb"
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_performance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Kasyanchuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: railties
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -66,6 +66,34 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: activestorage
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: actionmailer
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: sqlite3
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -330,11 +358,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
330
358
|
version: '0'
|
331
359
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
332
360
|
requirements:
|
333
|
-
- - "
|
361
|
+
- - ">="
|
334
362
|
- !ruby/object:Gem::Version
|
335
|
-
version:
|
363
|
+
version: '0'
|
336
364
|
requirements: []
|
337
|
-
rubygems_version: 3.4.
|
365
|
+
rubygems_version: 3.4.10
|
338
366
|
signing_key:
|
339
367
|
specification_version: 4
|
340
368
|
summary: Simple Rails Performance tracker. Alternative to the NewRelic, Datadog or
|