rails_performance 1.2.1 → 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: 1b7357f736b95447fdaaf95de2db6042794148a17b87ef517b8a8b7bda19212f
4
- data.tar.gz: 189eb4cb2151d20e00f18494768299b5ff8060c41e086db752af9360343f94d7
3
+ metadata.gz: eb7e94d5d6bb24923c0b13fce9d05c1bec53f2cb07305405852ca3803cee9f25
4
+ data.tar.gz: 162d27d3c200f077fa378bc6a83a11e13a4e3891b1b9104fde5a62f123cc7fff
5
5
  SHA512:
6
- metadata.gz: 075f60cbc47d2df3baa13259cae71230a3395afc9095f6cd48d6cd5fd15f1f15619c12c0ba5dbcb296fdc2ab6f9b4c89888db836a97066c2b2157f4f14e01058
7
- data.tar.gz: 1289acb796e6fc71a98fc36ceed9dc6cc709253725d73cd2be58220e265f05e8db34c977222d8f67e8cfe130a376ebbfe061221c8e6cc541a51ba9239273fd43
6
+ metadata.gz: 1b87d9850d195628f6765cf7ac18223a5ded9705f7d1d0df66ea70cd83f0669f8c24759e3ca499aad1c9d99786095492731cd86f575bbe1571bf99edeaa41a0b
7
+ data.tar.gz: c601d675b34ae16baa725630e22c7c9473d17851a694ea3ecffdea6ee59bd41eed2a816fcda051cd5baf5d40ced7054591260f0b0bfb6eb340de79fcf2a65895
data/README.md CHANGED
@@ -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
 
@@ -241,6 +248,7 @@ If "schema" how records are stored i Redis is changed, and this is a breaking ch
241
248
  - https://github.com/carl-printreleaf
242
249
  - https://github.com/langalex
243
250
  - https://github.com/olleolleolle
251
+ - https://github.com/desheikh
244
252
 
245
253
  [<img src="https://opensource-heroes.com/svg/embed/igorkasyanchuk/rails_performance"
246
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.1'
2
+ VERSION = '1.2.2'
3
3
  SCHEMA = '1.0.1'
4
4
  end
@@ -99,6 +99,14 @@ module RailsPerformance
99
99
  mattr_accessor :custom_data_proc
100
100
  @@custom_data_proc = nil
101
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
+
102
110
  def RailsPerformance.setup
103
111
  yield(self)
104
112
  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.2.1
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-11-29 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
14
  name: railties
@@ -273,7 +273,7 @@ files:
273
273
  - app/assets/images/user.svg
274
274
  - app/controllers/rails_performance/base_controller.rb
275
275
  - app/controllers/rails_performance/rails_performance_controller.rb
276
- - app/helpers/rails_performance/application_helper.rb
276
+ - app/helpers/rails_performance/rails_performance_helper.rb
277
277
  - app/views/rails_performance/_panel.html.erb
278
278
  - app/views/rails_performance/javascripts/_javascripts.html.erb
279
279
  - app/views/rails_performance/javascripts/app.js
@@ -362,7 +362,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
362
362
  - !ruby/object:Gem::Version
363
363
  version: '0'
364
364
  requirements: []
365
- rubygems_version: 3.4.10
365
+ rubygems_version: 3.5.3
366
366
  signing_key:
367
367
  specification_version: 4
368
368
  summary: Simple Rails Performance tracker. Alternative to the NewRelic, Datadog or