rails_performance 1.1.0 → 1.2.0.alpha2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 115679518abb747b5a5702a3383d86da4f969932146f00ef87339a66ab8b786b
4
- data.tar.gz: 8ee6382599f9ef62ec222407d56a03adf085a63e3717cc489b0d81bc9392bd03
3
+ metadata.gz: d3e98e1e0b65848122215689445e0687260d6ef641d5f3f68bb341abca10fab0
4
+ data.tar.gz: eaf9399287f35a89b26974a376fd504bd9389b273c0406a3a489e496de4443c5
5
5
  SHA512:
6
- metadata.gz: 34190351d34233c86da069a5728c7a504c55a1f8153d38da9e030b0702cb1c4fba55048d17f731e2be052d71e12d44a58b8dc8c8b2868d1cb7741560a7cd2651
7
- data.tar.gz: d8f937d0c6e2094061fba53613558ef4c61a368ec09cf11d2169b3b353a88c6cc2ce9c053a5fd6be2b4ed1d1cb808cab8ec42bc55c3976fa012c7f4263cf2dc0
6
+ metadata.gz: 148a68c40fe1cc8f360ae06583a71605bfb355cac4a49e9490d60db6940d08cea2a4fab7b61a76c3061fb4d93fe47bcf872b4cba3d8682d9151615300caef22a
7
+ data.tar.gz: eff97dc7df277c5a523a932437a4318371e9cfb5fc2821699f6e413a0d70287607e9049cb395cb377c5d987787b65eb4a6715aa0cecf87d13a1a85ac7bf49f33
data/README.md CHANGED
@@ -240,6 +240,9 @@ If "schema" how records are stored i Redis is changed, and this is a breacking c
240
240
  - https://github.com/D1ceWard
241
241
  - https://github.com/carl-printreleaf
242
242
 
243
+ [<img src="https://opensource-heroes.com/svg/embed/igorkasyanchuk/rails_performance"
244
+ />](https://opensource-heroes.com/r/igorkasyanchuk/rails_performance)
245
+
243
246
  ## License
244
247
 
245
248
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -1,5 +1,6 @@
1
1
  module RailsPerformance
2
2
  module ApplicationHelper
3
+
3
4
  def round_it(value, limit = 1)
4
5
  return nil unless value
5
6
  return value if value.is_a?(Integer)
@@ -49,7 +50,7 @@ module RailsPerformance
49
50
 
50
51
  def link_to_path(e)
51
52
  if e[:method] == 'GET'
52
- link_to(short_path(e[:path]), e[:path], target: '_blank')
53
+ link_to(short_path(e[:path]), e[:path], target: '_blank', title: short_path(e[:path]))
53
54
  else
54
55
  short_path(e[:path])
55
56
  end
@@ -105,7 +106,8 @@ module RailsPerformance
105
106
  end
106
107
 
107
108
  def format_datetime(e)
108
- e.strftime("%Y-%m-%d %H:%M:%S")
109
+ dt = RailsPerformance::Reports::BaseReport::time_in_app_time_zone(e)
110
+ I18n.l(dt, format: "%Y-%m-%d %H:%M:%S")
109
111
  end
110
112
 
111
113
  def active?(section)
@@ -1,8 +1,8 @@
1
1
  function showTIRChart(div, data, addon, name) {
2
2
  Highcharts.chart(div, {
3
- time: {
4
- timezone: 'Europe/Kiev'
5
- },
3
+ // time: {
4
+ // timezone: 'Europe/Kiev'
5
+ // },
6
6
  chart: {
7
7
  type: 'area',
8
8
  zoomType: 'x',
@@ -84,9 +84,9 @@ function showTIRChart(div, data, addon, name) {
84
84
 
85
85
  function showRTChart(div, data) {
86
86
  Highcharts.chart(div, {
87
- time: {
88
- timezone: 'Europe/Kiev'
89
- },
87
+ // time: {
88
+ // timezone: 'Europe/Kiev'
89
+ // },
90
90
  chart: {
91
91
  type: 'area',
92
92
  zoomType: 'x',
@@ -7,7 +7,10 @@
7
7
  <% end %>
8
8
  </td>
9
9
  <td><%= format_datetime e[:datetime] %></td>
10
- <td><%= link_to e[:controller] + '#' + e[:action], rails_performance.rails_performance_summary_path({controller_eq: e[:controller], action_eq: e[:action]}), remote: true %></td>
10
+ <td>
11
+ <% controller_action_info = e[:controller] + '#' + e[:action]%>
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 %>
13
+ </td>
11
14
  <td><%= e[:method] %></td>
12
15
  <td><%= e[:format] %></td>
13
16
  <td><%= link_to_path(e) %></td>
@@ -22,4 +25,4 @@
22
25
  <% end %>
23
26
  <% end %>
24
27
  </td>
25
- </tr>
28
+ </tr>
@@ -19,5 +19,11 @@
19
19
  <% end %>
20
20
  </tr>
21
21
  <% end %>
22
+
23
+ <% if @data.empty? %>
24
+ <tr>
25
+ <td>Nothing to show here. Perphaps details about the requests already expired. Setting "slow_requests_time_window" should be equal to "duration".</td>
26
+ </td>
27
+ <% end %>
22
28
  </tbody>
23
29
  </table>
@@ -20,8 +20,8 @@ module RailsPerformance
20
20
 
21
21
  def db
22
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)
23
+ (0..(RailsPerformance::Utils.days + 1)).to_a.reverse.each do |e|
24
+ RailsPerformance::DataSource.new(q: self.q.merge({ on: (Time.now - e.days).to_date }), type: type).add_to(result)
25
25
  end
26
26
  result
27
27
  end
@@ -118,4 +118,4 @@ module RailsPerformance
118
118
  end
119
119
 
120
120
  end
121
- end
121
+ end
@@ -55,7 +55,7 @@ module RailsPerformance
55
55
  next unless RailsPerformance.enabled
56
56
 
57
57
  ActionView::LogSubscriber.send :prepend, RailsPerformance::Extensions::View
58
- ActiveRecord::LogSubscriber.send :prepend, RailsPerformance::Extensions::Db
58
+ ActiveRecord::LogSubscriber.send :prepend, RailsPerformance::Extensions::Db if defined?(ActiveRecord)
59
59
 
60
60
  if defined?(::Rake::Task)
61
61
  require_relative './gems/rake_ext.rb'
@@ -30,4 +30,4 @@ module RailsPerformance
30
30
 
31
31
  end
32
32
  end
33
- end
33
+ end
@@ -20,6 +20,15 @@ module RailsPerformance
20
20
  end
21
21
 
22
22
  def set_defaults; end
23
+
24
+ def self.time_in_app_time_zone(time)
25
+ app_time_zone = ::Rails.application.config.time_zone
26
+ if app_time_zone.present?
27
+ time.in_time_zone(app_time_zone)
28
+ else
29
+ time
30
+ end
31
+ end
23
32
  end
24
33
  end
25
- end
34
+ end
@@ -10,7 +10,7 @@ module RailsPerformance
10
10
  stop = Time.at(60 * (Time.now.to_i / 60))
11
11
  current = stop - RailsPerformance.duration
12
12
  @data = []
13
- offset = Time.current.utc_offset
13
+ offset = Time.now.utc_offset
14
14
 
15
15
  # puts "current: #{current}"
16
16
  # puts "stop: #{stop}"
@@ -25,7 +25,8 @@ module RailsPerformance
25
25
  # add blank columns
26
26
  while current <= stop
27
27
  views = all[current.strftime(RailsPerformance::FORMAT)] || 0
28
- @data << [(current.to_i + offset) * 1000, views.round(2)]
28
+ time = RailsPerformance::Reports::ResponseTimeReport::time_in_app_time_zone(current)
29
+ @data << [(time.to_i + offset) * 1000, views.round(2)]
29
30
  current += 1.minute
30
31
  end
31
32
 
@@ -34,4 +35,4 @@ module RailsPerformance
34
35
  end
35
36
  end
36
37
  end
37
- end
38
+ end
@@ -11,7 +11,7 @@ module RailsPerformance
11
11
  stop = Time.at(60 * (Time.now.to_i / 60))
12
12
  current = stop - RailsPerformance.duration
13
13
  @data = []
14
- offset = Time.current.utc_offset
14
+ offset = Time.now.utc_offset
15
15
 
16
16
  # puts "current: #{current}"
17
17
  # puts "stop: #{stop}"
@@ -24,7 +24,8 @@ module RailsPerformance
24
24
  # add blank columns
25
25
  while current <= stop
26
26
  views = all[current.strftime(RailsPerformance::FORMAT)] || 0
27
- @data << [(current.to_i + offset) * 1000, views.to_i]
27
+ time = RailsPerformance::Reports::ResponseTimeReport::time_in_app_time_zone(current)
28
+ @data << [(time.to_i + offset) * 1000, views.round(2)]
28
29
  current += 1.minute
29
30
  end
30
31
 
@@ -34,4 +35,4 @@ module RailsPerformance
34
35
 
35
36
  end
36
37
  end
37
- end
38
+ end
@@ -31,4 +31,4 @@ module RailsPerformance
31
31
  end
32
32
 
33
33
  end
34
- end
34
+ end
@@ -1,4 +1,4 @@
1
1
  module RailsPerformance
2
- VERSION = '1.1.0'
2
+ VERSION = '1.2.0.alpha2'
3
3
  SCHEMA = '1.0.1'
4
4
  end
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.1.0
4
+ version: 1.2.0.alpha2
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-06-14 00:00:00.000000000 Z
11
+ date: 2023-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -314,9 +314,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
314
314
  version: '0'
315
315
  required_rubygems_version: !ruby/object:Gem::Requirement
316
316
  requirements:
317
- - - ">="
317
+ - - ">"
318
318
  - !ruby/object:Gem::Version
319
- version: '0'
319
+ version: 1.3.1
320
320
  requirements: []
321
321
  rubygems_version: 3.4.13
322
322
  signing_key: