rails_performance 0.9.7 → 0.9.8
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 +4 -4
- data/README.md +14 -3
- data/lib/generators/rails_performance/install/USAGE +8 -0
- data/lib/generators/rails_performance/install/install_generator.rb +8 -0
- data/lib/generators/rails_performance/install/templates/initializer.rb +23 -0
- data/lib/rails_performance.rb +7 -1
- data/lib/rails_performance/engine.rb +1 -0
- data/lib/rails_performance/instrument/metrics_collector.rb +2 -2
- data/lib/rails_performance/utils.rb +1 -2
- data/lib/rails_performance/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fd36bc442cc4c70eb58e007e07df73a44bf7ce745de9d4e50b94d8f41bfa050
|
4
|
+
data.tar.gz: 590694fef0143bf1080ef4eb224f6c6beb657728c53d0a13c825b8012fa7ca04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b49fda7d3eb4081a963c87417b1033a4a204f52b10bdb544a8984ab7367d77ebe38421e2447c68e45a4110d653ee27dd772a8ec5e6ac5ea80e7954e3210295d6
|
7
|
+
data.tar.gz: a649c5987684c72c3b6ded1847478a3bf4ace015054a4e2cbee293f33aaee3f3a442acefbcc59eeb9e9ae68cfd0ca95032c7d353ec38978bee664c4795c2baae
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Rails Performance
|
2
2
|
|
3
|
-
[](https://github.com/igorkasyanchuk/rails_performance/actions/workflows/ruby.yml)
|
4
4
|
[](https://www.railsjazz.com)
|
5
5
|
|
6
6
|
A self-hosted tool to monitor the performance of your Ruby on Rails application.
|
@@ -24,7 +24,7 @@ All data are stored in `local` Redis and not sent to any 3rd party servers.
|
|
24
24
|
|
25
25
|
## Production
|
26
26
|
|
27
|
-
Gem is production-ready. At least on my 2 applications with ~800 unique users per day it works perfectly.
|
27
|
+
Gem is production-ready. At least on my 2 applications with ~800 unique users per day it works perfectly.
|
28
28
|
|
29
29
|
Just don't forget to protect performance dashboard with http basic auth or check of current_user.
|
30
30
|
|
@@ -66,6 +66,7 @@ end if defined?(RailsPerformance)
|
|
66
66
|
```
|
67
67
|
|
68
68
|
## Installation
|
69
|
+
|
69
70
|
Add this line to your application's Gemfile:
|
70
71
|
|
71
72
|
```ruby
|
@@ -79,10 +80,19 @@ end
|
|
79
80
|
```
|
80
81
|
|
81
82
|
And then execute:
|
83
|
+
|
82
84
|
```bash
|
83
85
|
$ bundle
|
84
86
|
```
|
85
87
|
|
88
|
+
Create default configuration file:
|
89
|
+
|
90
|
+
```bash
|
91
|
+
$ rails generate rails_performance:install
|
92
|
+
```
|
93
|
+
|
94
|
+
Have a look at `config/initializers/rails_performance.rb` and adjust the configuration to your needs.
|
95
|
+
|
86
96
|
You must also have installed Redis server, because this gem is storing data into it.
|
87
97
|
|
88
98
|
After installation and configuration, start your Rails application, make a few requests, and open `https://localhost:3000/rails/performance` URL.
|
@@ -127,7 +137,6 @@ The idea of this gem grew from curriosity how many RPM my app receiving per day.
|
|
127
137
|
|
128
138
|
- documentation in Readme
|
129
139
|
- capture stacktrace of 500 errors and show in side panel
|
130
|
-
- generator for initial config
|
131
140
|
- CI for tests
|
132
141
|
- time/zone config?
|
133
142
|
- connected charts on dashboard, when zoom, when hover?
|
@@ -156,6 +165,8 @@ You are welcome to contribute. I've a big list of TODO.
|
|
156
165
|
- https://github.com/alagos
|
157
166
|
- https://github.com/klondaiker
|
158
167
|
- https://github.com/jules2689
|
168
|
+
- https://github.com/PedroAugustoRamalhoDuarte
|
169
|
+
- https://github.com/haffla
|
159
170
|
|
160
171
|
## License
|
161
172
|
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class RailsPerformance::InstallGenerator < Rails::Generators::Base
|
2
|
+
source_root File.expand_path('templates', __dir__)
|
3
|
+
desc "Generates initial config for rails_performance gem"
|
4
|
+
|
5
|
+
def copy_initializer_file
|
6
|
+
copy_file "initializer.rb", "config/initializers/rails_performance.rb"
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
RailsPerformance.setup do |config|
|
2
|
+
config.redis = Redis::Namespace.new("#{Rails.env}-rails-performance", redis: Redis.new)
|
3
|
+
config.duration = 4.hours
|
4
|
+
|
5
|
+
config.debug = false # currently not used>
|
6
|
+
config.enabled = true
|
7
|
+
|
8
|
+
# default path where to mount gem
|
9
|
+
config.mount_at = '/rails/performance'
|
10
|
+
|
11
|
+
# protect your Performance Dashboard with HTTP BASIC password
|
12
|
+
config.http_basic_authentication_enabled = false
|
13
|
+
config.http_basic_authentication_user_name = 'rails_performance'
|
14
|
+
config.http_basic_authentication_password = 'password12'
|
15
|
+
|
16
|
+
# if you need an additional rules to check user permissions
|
17
|
+
config.verify_access_proc = proc { |controller| true }
|
18
|
+
# for example when you have `current_user`
|
19
|
+
# config.verify_access_proc = proc { |controller| controller.current_user && controller.current_user.admin? }
|
20
|
+
|
21
|
+
# You can ignore endpoints with Rails standard notation controller#action
|
22
|
+
# config.ignored_endpoints = ['HomeController#contact']
|
23
|
+
end if defined?(RailsPerformance)
|
data/lib/rails_performance.rb
CHANGED
@@ -54,6 +54,12 @@ module RailsPerformance
|
|
54
54
|
mattr_accessor :verify_access_proc
|
55
55
|
@@verify_access_proc = proc { |controller| true }
|
56
56
|
|
57
|
+
mattr_reader :ignored_endpoints
|
58
|
+
def RailsPerformance.ignored_endpoints=(endpoints)
|
59
|
+
@@ignored_endpoints = Set.new(endpoints)
|
60
|
+
end
|
61
|
+
@@ignored_endpoints = []
|
62
|
+
|
57
63
|
def self.setup
|
58
64
|
yield(self)
|
59
65
|
end
|
@@ -62,4 +68,4 @@ end
|
|
62
68
|
|
63
69
|
RP = RailsPerformance
|
64
70
|
|
65
|
-
require "rails_performance/engine"
|
71
|
+
require "rails_performance/engine"
|
@@ -18,8 +18,8 @@ module RailsPerformance
|
|
18
18
|
def call(event_name, started, finished, event_id, payload)
|
19
19
|
event = ActiveSupport::Notifications::Event.new(event_name, started, finished, event_id, payload)
|
20
20
|
|
21
|
-
|
22
|
-
return if event.payload[:
|
21
|
+
return if %r{#{RailsPerformance.mount_at}}.match? event.payload[:path]
|
22
|
+
return if RailsPerformance.ignored_endpoints.include? "#{event.payload[:controller]}##{event.payload[:action]}"
|
23
23
|
|
24
24
|
record = {
|
25
25
|
controller: event.payload[:controller],
|
@@ -60,8 +60,7 @@ module RailsPerformance
|
|
60
60
|
def Utils.save_to_redis(key, value, expire = RP.duration.to_i)
|
61
61
|
# puts " [SAVE] key ---> #{key}\n"
|
62
62
|
# puts " value ---> #{value.to_json}\n\n"
|
63
|
-
RP.redis.set(key, value.to_json)
|
64
|
-
RP.redis.expire(key, expire.to_i)
|
63
|
+
RP.redis.set(key, value.to_json, ex: expire.to_i)
|
65
64
|
end
|
66
65
|
|
67
66
|
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: 0.9.
|
4
|
+
version: 0.9.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Kasyanchuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -142,6 +142,9 @@ files:
|
|
142
142
|
- app/views/rails_performance/stylesheets/panel.css
|
143
143
|
- app/views/rails_performance/stylesheets/style.css
|
144
144
|
- config/routes.rb
|
145
|
+
- lib/generators/rails_performance/install/USAGE
|
146
|
+
- lib/generators/rails_performance/install/install_generator.rb
|
147
|
+
- lib/generators/rails_performance/install/templates/initializer.rb
|
145
148
|
- lib/rails_performance.rb
|
146
149
|
- lib/rails_performance/data_source.rb
|
147
150
|
- lib/rails_performance/engine.rb
|
@@ -184,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
187
|
- !ruby/object:Gem::Version
|
185
188
|
version: '0'
|
186
189
|
requirements: []
|
187
|
-
rubygems_version: 3.
|
190
|
+
rubygems_version: 3.0.3
|
188
191
|
signing_key:
|
189
192
|
specification_version: 4
|
190
193
|
summary: Simple Rails Performance tracker. Alternative to the NewRelic, Datadog or
|