rails_performance 1.2.0 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9f2906db73d1a2227a6479131dded794f1b9bc734fe85883f91938ef28b4b7d
4
- data.tar.gz: 04fbf2f661f9873878b36a10906eb2346883d9f44c236557bbbc423270506c66
3
+ metadata.gz: eb7e94d5d6bb24923c0b13fce9d05c1bec53f2cb07305405852ca3803cee9f25
4
+ data.tar.gz: 162d27d3c200f077fa378bc6a83a11e13a4e3891b1b9104fde5a62f123cc7fff
5
5
  SHA512:
6
- metadata.gz: e3be04836a44e3c1eddc5b5f338667952128ee1d99b70bbb635bf252205f21e99a4c4d60157a3517927801de5342671d02f9648918074ecd60152fd7ec7c5222
7
- data.tar.gz: ec663b71500e15c4c29bada3d11111629c3130281a0140a7a3e872068ac0eecc6e13cd50b0a867254a3ff03d472dfc6b29d0bb2cdea84ae212a48b04c3b8beaa
6
+ metadata.gz: 1b87d9850d195628f6765cf7ac18223a5ded9705f7d1d0df66ea70cd83f0669f8c24759e3ca499aad1c9d99786095492731cd86f575bbe1571bf99edeaa41a0b
7
+ data.tar.gz: c601d675b34ae16baa725630e22c7c9473d17851a694ea3ecffdea6ee59bd41eed2a816fcda051cd5baf5d40ced7054591260f0b0bfb6eb340de79fcf2a65895
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 configulation is listed below. But you can overide it.
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
 
@@ -93,7 +93,14 @@ RailsPerformance.setup do |config|
93
93
  # config home button link
94
94
  config.home_link = '/'
95
95
 
96
+ # To skip some Rake tasks from monitoring
96
97
  config.skipable_rake_tasks = ['webpacker:compile']
98
+
99
+ # To monitor rake tasks performance, you need to include rake tasks
100
+ # config.include_rake_tasks = false
101
+
102
+ # To monitor custom events with `RailsPerformance.measure` block
103
+ # config.include_custom_events = true
97
104
  end if defined?(RailsPerformance)
98
105
  ```
99
106
 
@@ -196,7 +203,7 @@ For UI changes you need to use Bulma CSS (https://bulma.io/documentation).
196
203
 
197
204
  ## Why
198
205
 
199
- The idea of this gem grew from curriosity how many RPM my app receiving per day. Later it evolutionated to something more powerful.
206
+ The idea of this gem grew from curiosity how many RPM my app receiving per day. Later it evolved to something more powerful.
200
207
 
201
208
  ## TODO
202
209
 
@@ -227,7 +234,7 @@ The idea of this gem grew from curriosity how many RPM my app receiving per day.
227
234
 
228
235
  You are welcome to contribute. I've a big list of TODO.
229
236
 
230
- If "schema" how records are stored i Redis is changed, and this is a breacking change, update: `RailsPerformance::SCHEMA` to a newer value.
237
+ If "schema" how records are stored i Redis is changed, and this is a breaking change, update: `RailsPerformance::SCHEMA` to a newer value.
231
238
 
232
239
  ## Big thanks to contributors
233
240
 
@@ -239,6 +246,9 @@ If "schema" how records are stored i Redis is changed, and this is a breacking c
239
246
  - https://github.com/haffla
240
247
  - https://github.com/D1ceWard
241
248
  - https://github.com/carl-printreleaf
249
+ - https://github.com/langalex
250
+ - https://github.com/olleolleolle
251
+ - https://github.com/desheikh
242
252
 
243
253
  [<img src="https://opensource-heroes.com/svg/embed/igorkasyanchuk/rails_performance"
244
254
  />](https://opensource-heroes.com/r/igorkasyanchuk/rails_performance)
@@ -2,7 +2,6 @@ require_relative './base_controller.rb'
2
2
 
3
3
  module RailsPerformance
4
4
  class RailsPerformanceController < RailsPerformance::BaseController
5
- include RailsPerformance::ApplicationHelper
6
5
 
7
6
  protect_from_forgery except: :recent
8
7
 
@@ -1,5 +1,5 @@
1
1
  module RailsPerformance
2
- module ApplicationHelper
2
+ module RailsPerformanceHelper
3
3
 
4
4
  def round_it(value, limit = 1)
5
5
  return nil unless value
@@ -28,8 +28,12 @@
28
28
  <% if defined?(Grape) %>
29
29
  <%= link_to 'Grape', rails_performance.rails_performance_grape_url, class: "navbar-item #{active?(:grape)}" %>
30
30
  <% end %>
31
- <%= link_to 'Rake', rails_performance.rails_performance_rake_url, class: "navbar-item #{active?(:rake)}" %>
32
- <%= link_to 'Custom Events', rails_performance.rails_performance_custom_url, class: "navbar-item #{active?(:custom)}" %>
31
+ <% if RailsPerformance.include_rake_tasks %>
32
+ <%= link_to 'Rake', rails_performance.rails_performance_rake_url, class: "navbar-item #{active?(:rake)}" %>
33
+ <% end %>
34
+ <% if RailsPerformance.include_custom_events %>
35
+ <%= link_to 'Custom Events', rails_performance.rails_performance_custom_url, class: "navbar-item #{active?(:custom)}" %>
36
+ <% end %>
33
37
  </div>
34
38
 
35
39
  <div class="navbar-end">
@@ -32,4 +32,7 @@ RailsPerformance.setup do |config|
32
32
 
33
33
  # config home button link
34
34
  config.home_link = '/'
35
+ config.skipable_rake_tasks = ['webpacker:compile']
36
+ config.include_rake_tasks = false
37
+ config.include_custom_events = true
35
38
  end if defined?(RailsPerformance)
@@ -57,7 +57,7 @@ module RailsPerformance
57
57
  ActionView::LogSubscriber.send :prepend, RailsPerformance::Extensions::View
58
58
  ActiveRecord::LogSubscriber.send :prepend, RailsPerformance::Extensions::Db if defined?(ActiveRecord)
59
59
 
60
- if defined?(::Rake::Task)
60
+ if defined?(::Rake::Task) && RailsPerformance.include_rake_tasks
61
61
  require_relative './gems/rake_ext.rb'
62
62
  RailsPerformance::Gems::RakeExt.init
63
63
  end
@@ -5,6 +5,7 @@ module RailsPerformance
5
5
 
6
6
  def measure(tag_name, namespace_name = nil)
7
7
  return yield unless RailsPerformance.enabled
8
+ return yield unless RailsPerformance.include_custom_events
8
9
 
9
10
  begin
10
11
  now = Time.current
@@ -14,8 +14,10 @@ module RailsPerformance
14
14
  raise(ex)
15
15
  ensure
16
16
  if !RailsPerformance.skipable_rake_tasks.include?(self.name)
17
+ task_info = RailsPerformance::Gems::RakeExt.find_task_name(*args)
18
+ task_info = [self.name] if task_info.empty?
17
19
  RailsPerformance::Models::RakeRecord.new(
18
- task: RailsPerformance::Gems::RakeExt.find_task_name(*args),
20
+ task: task_info,
19
21
  datetime: now.strftime(RailsPerformance::FORMAT),
20
22
  datetimei: now.to_i,
21
23
  duration: (Time.current - now) * 1000,
@@ -1,4 +1,4 @@
1
1
  module RailsPerformance
2
- VERSION = '1.2.0'
2
+ VERSION = '1.2.2'
3
3
  SCHEMA = '1.0.1'
4
4
  end
@@ -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"
@@ -98,6 +99,14 @@ module RailsPerformance
98
99
  mattr_accessor :custom_data_proc
99
100
  @@custom_data_proc = nil
100
101
 
102
+ # include rake tasks
103
+ mattr_accessor :include_rake_tasks
104
+ @@include_rake_tasks = false
105
+
106
+ # include custom events
107
+ mattr_accessor :include_custom_events
108
+ @@include_custom_events = true
109
+
101
110
  def RailsPerformance.setup
102
111
  yield(self)
103
112
  end
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.0
4
+ version: 1.2.2
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-25 00:00:00.000000000 Z
11
+ date: 2024-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rails
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
@@ -245,7 +273,7 @@ files:
245
273
  - app/assets/images/user.svg
246
274
  - app/controllers/rails_performance/base_controller.rb
247
275
  - app/controllers/rails_performance/rails_performance_controller.rb
248
- - app/helpers/rails_performance/application_helper.rb
276
+ - app/helpers/rails_performance/rails_performance_helper.rb
249
277
  - app/views/rails_performance/_panel.html.erb
250
278
  - app/views/rails_performance/javascripts/_javascripts.html.erb
251
279
  - app/views/rails_performance/javascripts/app.js
@@ -334,7 +362,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
334
362
  - !ruby/object:Gem::Version
335
363
  version: '0'
336
364
  requirements: []
337
- rubygems_version: 3.4.13
365
+ rubygems_version: 3.5.3
338
366
  signing_key:
339
367
  specification_version: 4
340
368
  summary: Simple Rails Performance tracker. Alternative to the NewRelic, Datadog or