rails_performance 1.4.1 → 1.4.2

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: 0a493c11a3166ec07cfc2b6f2d4956cc09b867c24d280ba97836d411df384679
4
- data.tar.gz: 700cf3ac2d08eed0fcd0a8549e8488b88e1b92b79019efc8db17c7f4a0370d6b
3
+ metadata.gz: d387037eea90f299a14499105f68cd78794ee7a36122d45081c488b9ca3fb6dd
4
+ data.tar.gz: 1c49de1b612f86f8089fdd2765b53bcbdddb2bb65d4890eacdf068f0ca14ecc3
5
5
  SHA512:
6
- metadata.gz: 49eef9ff013e574007cea89b8fe288fa4d627e8a72cfc3770a4a8e291d599d99905f61eb5c103ad5c3f749158cffb4179f8fd39a40159f6ee759fee6422dc548
7
- data.tar.gz: 7d17c31b43b65a912c05f9de138959e19442412c9fe3dbecb70973c8133d6cf341ad409e1abf99f71a2511edec9664a71ed14cd39d2ac96ee113874f994818b3
6
+ metadata.gz: 208578b1cc4a8a4b261c9607d89b045983ab2be0cc1ef811059be38a3c02dd4f9b333a0937900733b04ad8058c1c920c02f333bc31b9fae13c1629123456a99d
7
+ data.tar.gz: 9066e380c0d9309554e7574298d8bda95570e4f0851fdfa586c675f998bcdfaed993decd336d9de4c6b1b6ed55b0065fc368aba8ba23c7627690db18bedae36b
data/README.md CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  [![Tests](https://github.com/igorkasyanchuk/rails_performance/actions/workflows/ruby.yml/badge.svg)](https://github.com/igorkasyanchuk/rails_performance/actions/workflows/ruby.yml)
4
4
  [![RailsJazz](https://github.com/igorkasyanchuk/rails_time_travel/blob/main/docs/my_other.svg?raw=true)](https://www.railsjazz.com)
5
- [![Listed on OpenSource-Heroes.com](https://opensource-heroes.com/badge-v1.svg)](https://opensource-heroes.com/r/igorkasyanchuk/rails_performance)
5
+ [My Cheatsheets](https://cheatsheetshero.com/user/igor-kasyanchuk)
6
+
7
+ [!["Buy Me A Coffee"](https://github.com/igorkasyanchuk/get-smart/blob/main/docs/snapshot-bmc-button-small.png?raw=true)](https://buymeacoffee.com/igorkasyanchuk)
6
8
 
7
9
  A self-hosted tool to monitor the performance of your Ruby on Rails application.
8
10
 
@@ -242,7 +244,7 @@ RailsPerformance.measure("some label", "some namespace") do
242
244
  end
243
245
  ```
244
246
 
245
- ## Using with Rails Namespace
247
+ ## Using with Redis Namespace
246
248
 
247
249
  If you want to use Redis namespace (for example when you have multiple apps running on the same server), you can configure it like this:
248
250
 
@@ -332,14 +334,11 @@ If "schema" how records are stored i Redis is changed, and this is a breaking ch
332
334
 
333
335
  https://github.com/igorkasyanchuk/rails_performance/graphs/contributors
334
336
 
335
- ## Other
336
-
337
- [<img src="https://opensource-heroes.com/svg/embed/igorkasyanchuk/rails_performance"
338
- />](https://opensource-heroes.com/r/igorkasyanchuk/rails_performance)
339
-
340
337
  ## License
341
338
 
342
339
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
343
340
 
344
341
  [<img src="https://github.com/igorkasyanchuk/rails_time_travel/blob/main/docs/more_gems.png?raw=true"
345
342
  />](https://www.railsjazz.com/?utm_source=github&utm_medium=bottom&utm_campaign=rails_performance)
343
+
344
+ [!["Buy Me A Coffee"](https://github.com/igorkasyanchuk/get-smart/blob/main/docs/snapshot-bmc-button.png?raw=true)](https://buymeacoffee.com/igorkasyanchuk)
@@ -4,6 +4,7 @@ module RailsPerformance
4
4
  layout "rails_performance/layouts/rails_performance"
5
5
 
6
6
  before_action :verify_access
7
+ after_action :set_permissive_csp
7
8
 
8
9
  if RailsPerformance.http_basic_authentication_enabled
9
10
  http_basic_authenticate_with \
@@ -17,5 +18,9 @@ module RailsPerformance
17
18
  result = RailsPerformance.verify_access_proc.call(self)
18
19
  redirect_to("/", error: "Access Denied", status: 401) unless result
19
20
  end
21
+
22
+ def set_permissive_csp
23
+ response.headers["Content-Security-Policy"] = "default-src 'self' https:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https:; style-src 'self' 'unsafe-inline' https:"
24
+ end
20
25
  end
21
26
  end
@@ -23,6 +23,10 @@ module RailsPerformance
23
23
  end
24
24
 
25
25
  def extract_duration(str)
26
+ if str.is_a?(Hash)
27
+ return str[:duration].to_s if str[:duration]
28
+ end
29
+
26
30
  if str =~ /Duration: (\d+.?\d+?ms)/i
27
31
  $1
28
32
  else
@@ -8,11 +8,11 @@ if defined?(RailsPerformance)
8
8
 
9
9
  # Recent Requests configuration
10
10
  config.recent_requests_time_window = 60.minutes
11
- # confog.recent_requests_limit = nil # numnber of recent requests
11
+ # config.recent_requests_limit = nil # number of recent requests
12
12
 
13
13
  # Slow Requests configuration
14
14
  config.slow_requests_time_window = 4.hours
15
- # config.slow_requests_limit = 500 # numnber of slow requests
15
+ # config.slow_requests_limit = 500 # number of slow requests
16
16
  config.slow_requests_threshold = 500 # ms
17
17
 
18
18
  config.debug = false # currently not used>
@@ -44,7 +44,7 @@ module RailsPerformance
44
44
  memory = fetch_process_memory_usage
45
45
  disk = fetch_disk_usage
46
46
 
47
- store_data({cpu:, memory:, disk:})
47
+ store_data({cpu: cpu, memory: memory, disk: disk})
48
48
  end
49
49
 
50
50
  def fetch_process_cpu_usage
@@ -10,7 +10,7 @@ module RailsPerformance
10
10
  .collect { |e| e.record_hash }
11
11
  .select { |e| e if e[sort] > RailsPerformance.slow_requests_time_window.ago.to_i }
12
12
  .sort { |a, b| b[sort] <=> a[sort] }
13
- .filter { |e| e[:duration] > RailsPerformance.slow_requests_threshold.to_i }
13
+ .filter { |e| e[:duration].to_f > RailsPerformance.slow_requests_threshold.to_i }
14
14
  .first(limit)
15
15
  end
16
16
 
@@ -1,4 +1,4 @@
1
1
  module RailsPerformance
2
- VERSION = "1.4.1"
2
+ VERSION = "1.4.2"
3
3
  SCHEMA = "1.0.2"
4
4
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_performance
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Kasyanchuk
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-11-27 00:00:00.000000000 Z
10
+ date: 2025-05-28 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: railties
@@ -384,7 +383,6 @@ homepage: https://github.com/igorkasyanchuk/rails_performance
384
383
  licenses:
385
384
  - MIT
386
385
  metadata: {}
387
- post_install_message:
388
386
  rdoc_options: []
389
387
  require_paths:
390
388
  - lib
@@ -399,8 +397,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
399
397
  - !ruby/object:Gem::Version
400
398
  version: '0'
401
399
  requirements: []
402
- rubygems_version: 3.5.22
403
- signing_key:
400
+ rubygems_version: 3.6.3
404
401
  specification_version: 4
405
402
  summary: Simple Rails Performance tracker. Alternative to the NewRelic, Datadog or
406
403
  other services.