rails_performance 1.4.0.alpha3 → 1.4.0.alpha5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -1
- data/app/controllers/rails_performance/rails_performance_controller.rb +1 -1
- data/app/helpers/rails_performance/rails_performance_helper.rb +0 -4
- data/app/views/rails_performance/javascripts/app.js +6 -0
- data/app/views/rails_performance/layouts/rails_performance.html.erb +3 -0
- data/lib/generators/rails_performance/install/templates/initializer.rb +4 -0
- data/lib/rails_performance/data_source.rb +5 -4
- data/lib/rails_performance/extensions/resources_monitor.rb +1 -3
- data/lib/rails_performance/gems/custom_ext.rb +2 -2
- data/lib/rails_performance/gems/delayed_job_ext.rb +2 -2
- data/lib/rails_performance/gems/grape_ext.rb +1 -1
- data/lib/rails_performance/gems/rake_ext.rb +2 -2
- data/lib/rails_performance/gems/sidekiq_ext.rb +2 -2
- data/lib/rails_performance/instrument/metrics_collector.rb +2 -0
- data/lib/rails_performance/models/base_record.rb +1 -15
- data/lib/rails_performance/models/custom_record.rb +1 -1
- data/lib/rails_performance/models/delayed_job_record.rb +1 -1
- data/lib/rails_performance/models/grape_record.rb +1 -1
- data/lib/rails_performance/models/rake_record.rb +1 -1
- data/lib/rails_performance/models/request_record.rb +1 -1
- data/lib/rails_performance/models/resource_record.rb +3 -2
- data/lib/rails_performance/models/sidekiq_record.rb +1 -1
- data/lib/rails_performance/rails/middleware.rb +2 -2
- data/lib/rails_performance/reports/base_report.rb +12 -11
- data/lib/rails_performance/reports/resources_report.rb +10 -11
- data/lib/rails_performance/thread/current_request.rb +1 -1
- data/lib/rails_performance/utils.rb +11 -3
- data/lib/rails_performance/version.rb +2 -2
- data/lib/rails_performance.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9541b647e5e0ae0e49c8ffe55befda74884e9a8c53c9557cffd4b8c42ca23fc
|
4
|
+
data.tar.gz: 8b1ada0884c84dbbab0306cffab9bbb4f4b04b0fc4107a55747eae5416ed26ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2db12562f40ce01aa3bffa6a545e4567469972ec5ab79a0e7318dbe526b09c62e6c2f6f2fecadecb44485e5ea6f3bb4a7a4d632d7938e9a347af86144ea19b9
|
7
|
+
data.tar.gz: 7e7bed31f33b4f0af24362ec621f7d066b33d3225103e08b2819bc33b9b69a1fbc1d5c4ba65221d1c47186b6ab9d954d403eddf6317c7b9a94dfd445ca8f9004
|
data/README.md
CHANGED
@@ -117,9 +117,21 @@ RailsPerformance.setup do |config|
|
|
117
117
|
|
118
118
|
# To monitor custom events with `RailsPerformance.measure` block
|
119
119
|
# config.include_custom_events = true
|
120
|
+
|
121
|
+
# To monitor system resources (CPU, memory, disk)
|
122
|
+
# to enabled add required gems (see README)
|
123
|
+
# config.system_monitor_duration = 24.hours
|
120
124
|
end if defined?(RailsPerformance)
|
121
125
|
```
|
122
126
|
|
127
|
+
Additionally you might need to configure app time zone. You can do it in `config/application.rb`:
|
128
|
+
|
129
|
+
```ruby
|
130
|
+
config.time_zone = 'Eastern Time (US & Canada)'
|
131
|
+
```
|
132
|
+
|
133
|
+
Gem will present charts/tables in the app timezone. If it's not set, it will use UTC.
|
134
|
+
|
123
135
|
## Installation
|
124
136
|
|
125
137
|
Add this line to your application's Gemfile:
|
@@ -175,7 +187,9 @@ You need to configure `config.custom_data_proc`. And you can capture current_use
|
|
175
187
|
![Custom Data](docs/custom_data.png)
|
176
188
|
|
177
189
|
|
178
|
-
###
|
190
|
+
### Server Monitoring
|
191
|
+
|
192
|
+
![Server Monitoring](docs/rails_performance_cpu_memory_storage.png)
|
179
193
|
|
180
194
|
You can monitor system resources (CPU, memory, disk) by adding a gem to your Gemfile:
|
181
195
|
|
@@ -197,6 +211,14 @@ Basically using this code:
|
|
197
211
|
end
|
198
212
|
```
|
199
213
|
|
214
|
+
For Kamal for example:
|
215
|
+
|
216
|
+
```yaml
|
217
|
+
env:
|
218
|
+
clear:
|
219
|
+
RAILS_PERFORMANCE_SERVER_ID: "server"
|
220
|
+
```
|
221
|
+
|
200
222
|
You can also specifify custom "context" and "role" for monitoring, by changing the env variables:
|
201
223
|
|
202
224
|
```ruby
|
@@ -260,6 +282,8 @@ After this:
|
|
260
282
|
- rails s
|
261
283
|
- rake test
|
262
284
|
|
285
|
+
If you need quickly clear Redis data, you can use `rails runner 'RailsPerformance.redis.flushdb'`.
|
286
|
+
|
263
287
|
Like a regular web development.
|
264
288
|
|
265
289
|
Please note that to simplify integration with other apps all CSS/JS are bundled inside, and delivered in body of the request. This is to avoid integration with assets pipeline or webpacker.
|
@@ -15,7 +15,7 @@ module RailsPerformance
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def resources
|
18
|
-
@datasource = RailsPerformance::DataSource.new(**prepare_query(params), type: :resources)
|
18
|
+
@datasource = RailsPerformance::DataSource.new(**prepare_query(params), type: :resources, days: RailsPerformance::Utils.days(RailsPerformance.system_monitor_duration))
|
19
19
|
db = @datasource.db
|
20
20
|
|
21
21
|
@resources_report = RailsPerformance::Reports::ResourcesReport.new(db)
|
@@ -6,6 +6,9 @@
|
|
6
6
|
<title>Rails Performance</title>
|
7
7
|
<%= csrf_meta_tags %>
|
8
8
|
<%= csp_meta_tag if ::Rails::VERSION::STRING.to_f >= 5.2 %>
|
9
|
+
<script>
|
10
|
+
window.APP_TIME_ZONE = '<%= Rails.application.config.time_zone.presence || 'UTC' %>';
|
11
|
+
</script>
|
9
12
|
<%= render '/rails_performance/stylesheets/stylesheets' %>
|
10
13
|
<link rel="shortcut icon" href="/favicon.ico">
|
11
14
|
</head>
|
@@ -52,5 +52,9 @@ if defined?(RailsPerformance)
|
|
52
52
|
config.skipable_rake_tasks = ["webpacker:compile"]
|
53
53
|
config.include_rake_tasks = false
|
54
54
|
config.include_custom_events = true
|
55
|
+
|
56
|
+
# If enabled, the system monitor will be displayed on the dashboard
|
57
|
+
# to enabled add required gems (see README)
|
58
|
+
# config.system_monitor_duration = 24.hours
|
55
59
|
end
|
56
60
|
end
|
@@ -10,19 +10,20 @@ module RailsPerformance
|
|
10
10
|
resources: RailsPerformance::Models::ResourceRecord
|
11
11
|
}
|
12
12
|
|
13
|
-
attr_reader :q, :klass, :type
|
13
|
+
attr_reader :q, :klass, :type, :days
|
14
14
|
|
15
|
-
def initialize(type:, q: {})
|
15
|
+
def initialize(type:, q: {}, days: RailsPerformance::Utils.days(RailsPerformance.duration))
|
16
16
|
@type = type
|
17
17
|
@klass = KLASSES[type]
|
18
18
|
q[:on] ||= Date.today
|
19
19
|
@q = q
|
20
|
+
@days = days
|
20
21
|
end
|
21
22
|
|
22
23
|
def db
|
23
24
|
result = RailsPerformance::Models::Collection.new
|
24
|
-
now =
|
25
|
-
(0..
|
25
|
+
now = RailsPerformance::Utils.time
|
26
|
+
(0..days).to_a.reverse_each do |e|
|
26
27
|
RailsPerformance::DataSource.new(q: q.merge({on: (now - e.days).to_date}), type: type).add_to(result)
|
27
28
|
end
|
28
29
|
result
|
@@ -18,7 +18,6 @@ module RailsPerformance
|
|
18
18
|
@mutex.synchronize do
|
19
19
|
return if @thread
|
20
20
|
|
21
|
-
# puts "Starting monitoring for #{context} - #{role}"
|
22
21
|
@thread = Thread.new do
|
23
22
|
loop do
|
24
23
|
run
|
@@ -35,7 +34,6 @@ module RailsPerformance
|
|
35
34
|
@mutex.synchronize do
|
36
35
|
return unless @thread
|
37
36
|
|
38
|
-
# puts "Stopping monitoring"
|
39
37
|
@thread.kill
|
40
38
|
@thread = nil
|
41
39
|
end
|
@@ -83,7 +81,7 @@ module RailsPerformance
|
|
83
81
|
def store_data(data)
|
84
82
|
::Rails.logger.info("Server: #{server_id}, Context: #{context}, Role: #{role}, data: #{data}")
|
85
83
|
|
86
|
-
now =
|
84
|
+
now = RailsPerformance::Utils.time
|
87
85
|
now = now.change(sec: 0, usec: 0)
|
88
86
|
RailsPerformance::Models::ResourceRecord.new(
|
89
87
|
server: server_id,
|
@@ -8,7 +8,7 @@ module RailsPerformance
|
|
8
8
|
return yield unless RailsPerformance.include_custom_events
|
9
9
|
|
10
10
|
begin
|
11
|
-
now =
|
11
|
+
now = RailsPerformance::Utils.time
|
12
12
|
status = "success"
|
13
13
|
result = yield
|
14
14
|
result
|
@@ -20,7 +20,7 @@ module RailsPerformance
|
|
20
20
|
tag_name: tag_name,
|
21
21
|
namespace_name: namespace_name,
|
22
22
|
status: status,
|
23
|
-
duration: (
|
23
|
+
duration: (RailsPerformance::Utils.time - now) * 1000,
|
24
24
|
datetime: now.strftime(RailsPerformance::FORMAT),
|
25
25
|
datetimei: now.to_i
|
26
26
|
).save
|
@@ -4,7 +4,7 @@ module RailsPerformance
|
|
4
4
|
class Plugin < ::Delayed::Plugin
|
5
5
|
callbacks do |lifecycle|
|
6
6
|
lifecycle.around(:invoke_job) do |job, *args, &block|
|
7
|
-
now =
|
7
|
+
now = RailsPerformance::Utils.time
|
8
8
|
block.call(job, *args)
|
9
9
|
status = "success"
|
10
10
|
rescue Exception => error # rubocop:disable Lint/RescueException
|
@@ -14,7 +14,7 @@ module RailsPerformance
|
|
14
14
|
meta_data = RailsPerformance::Gems::DelayedJobExt::Plugin.meta(job.payload_object)
|
15
15
|
record = RailsPerformance::Models::DelayedJobRecord.new(
|
16
16
|
jid: job.id,
|
17
|
-
duration: (
|
17
|
+
duration: (RailsPerformance::Utils.time - now) * 1000,
|
18
18
|
datetime: now.strftime(RailsPerformance::FORMAT),
|
19
19
|
datetimei: now.to_i,
|
20
20
|
source_type: meta_data[0],
|
@@ -6,7 +6,7 @@ module RailsPerformance
|
|
6
6
|
# TODO change to set
|
7
7
|
CurrentRequest.current.ignore.add(:performance)
|
8
8
|
|
9
|
-
now =
|
9
|
+
now = RailsPerformance::Utils.time
|
10
10
|
CurrentRequest.current.data ||= {}
|
11
11
|
CurrentRequest.current.record ||= RailsPerformance::Models::GrapeRecord.new(request_id: CurrentRequest.current.request_id)
|
12
12
|
CurrentRequest.current.record.datetimei ||= now.to_i
|
@@ -4,7 +4,7 @@ module RailsPerformance
|
|
4
4
|
def self.init
|
5
5
|
::Rake::Task.class_eval do
|
6
6
|
def invoke_with_rails_performance(*args)
|
7
|
-
now =
|
7
|
+
now = RailsPerformance::Utils.time
|
8
8
|
status = "success"
|
9
9
|
invoke_without_new_rails_performance(*args)
|
10
10
|
rescue Exception => ex # rubocop:disable Lint/RescueException
|
@@ -18,7 +18,7 @@ module RailsPerformance
|
|
18
18
|
task: task_info,
|
19
19
|
datetime: now.strftime(RailsPerformance::FORMAT),
|
20
20
|
datetimei: now.to_i,
|
21
|
-
duration: (
|
21
|
+
duration: (RailsPerformance::Utils.time - now) * 1000,
|
22
22
|
status: status
|
23
23
|
).save
|
24
24
|
end
|
@@ -5,7 +5,7 @@ module RailsPerformance
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def call(worker, msg, queue)
|
8
|
-
now =
|
8
|
+
now = RailsPerformance::Utils.time
|
9
9
|
record = RailsPerformance::Models::SidekiqRecord.new(
|
10
10
|
enqueued_ati: msg["enqueued_at"].to_i,
|
11
11
|
datetimei: msg["created_at"].to_i,
|
@@ -25,7 +25,7 @@ module RailsPerformance
|
|
25
25
|
raise ex
|
26
26
|
ensure
|
27
27
|
# store in ms instead of seconds
|
28
|
-
record.duration = (
|
28
|
+
record.duration = (RailsPerformance::Utils.time - now) * 1000
|
29
29
|
record.save
|
30
30
|
end
|
31
31
|
end
|
@@ -25,6 +25,8 @@ module RailsPerformance
|
|
25
25
|
return if RailsPerformance.ignored_endpoints.include? "#{event.payload[:controller]}##{event.payload[:action]}"
|
26
26
|
return if RailsPerformance.ignored_paths.any? { |p| event.payload[:path].start_with?(p) }
|
27
27
|
|
28
|
+
finished = finished.utc
|
29
|
+
|
28
30
|
record = {
|
29
31
|
controller: event.payload[:controller],
|
30
32
|
action: event.payload[:action],
|
@@ -1,18 +1,6 @@
|
|
1
1
|
module RailsPerformance
|
2
2
|
module Models
|
3
3
|
class BaseRecord
|
4
|
-
def self.from_db(key, value)
|
5
|
-
raise "implement me"
|
6
|
-
end
|
7
|
-
|
8
|
-
def save
|
9
|
-
raise "implement me"
|
10
|
-
end
|
11
|
-
|
12
|
-
def record_hash
|
13
|
-
raise "implement me"
|
14
|
-
end
|
15
|
-
|
16
4
|
def value
|
17
5
|
@value ||= JSON.parse(@json || "{}")
|
18
6
|
end
|
@@ -24,9 +12,7 @@ module RailsPerformance
|
|
24
12
|
private
|
25
13
|
|
26
14
|
def ms(e)
|
27
|
-
if e
|
28
|
-
e.to_f.round(1).to_s + " ms"
|
29
|
-
end
|
15
|
+
e.to_f.round(1).to_s + " ms" if e
|
30
16
|
end
|
31
17
|
end
|
32
18
|
end
|
@@ -94,7 +94,7 @@ module RailsPerformance
|
|
94
94
|
method: method,
|
95
95
|
path: path,
|
96
96
|
request_id: request_id,
|
97
|
-
datetime:
|
97
|
+
datetime: RailsPerformance::Utils.from_datetimei(datetimei.to_i),
|
98
98
|
datetimei: datetimei,
|
99
99
|
duration: value["duration"],
|
100
100
|
db_runtime: value["db_runtime"],
|
@@ -31,7 +31,7 @@ module RailsPerformance
|
|
31
31
|
role: role,
|
32
32
|
context: context,
|
33
33
|
datetime: datetime,
|
34
|
-
datetimei:
|
34
|
+
datetimei: RailsPerformance::Utils.from_datetimei(datetimei.to_i),
|
35
35
|
cpu: value["cpu"],
|
36
36
|
memory: value["memory"],
|
37
37
|
disk: value["disk"]
|
@@ -40,7 +40,8 @@ module RailsPerformance
|
|
40
40
|
|
41
41
|
def save
|
42
42
|
key = "resource|server|#{server}|context|#{context}|role|#{role}|datetime|#{datetime}|datetimei|#{datetimei}|END|#{RailsPerformance::SCHEMA}"
|
43
|
-
|
43
|
+
# with longer expiration time
|
44
|
+
Utils.save_to_redis(key, json, RailsPerformance.system_monitor_duration.to_i)
|
44
45
|
end
|
45
46
|
end
|
46
47
|
end
|
@@ -41,7 +41,7 @@ module RailsPerformance
|
|
41
41
|
def call!(env)
|
42
42
|
@status, @headers, @response = @app.call(env)
|
43
43
|
|
44
|
-
# t =
|
44
|
+
# t = RailsPerformance::Utils.time
|
45
45
|
if !RailsPerformance.skip
|
46
46
|
if !CurrentRequest.current.ignore.include?(:performance) # grape is executed first, and than ignore regular future storage of "controller"-like request
|
47
47
|
if (data = CurrentRequest.current.data)
|
@@ -66,7 +66,7 @@ module RailsPerformance
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
69
|
-
# puts "==> store performance data: #{(
|
69
|
+
# puts "==> store performance data: #{(RailsPerformance::Utils.time - t).round(3)}ms"
|
70
70
|
|
71
71
|
[@status, @headers, @response]
|
72
72
|
end
|
@@ -30,11 +30,12 @@ module RailsPerformance
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
# TODO: simplify this method, and combine with nullify_data
|
33
34
|
def calculate_data
|
34
|
-
now =
|
35
|
+
now = RailsPerformance::Utils.time
|
35
36
|
now = now.change(sec: 0, usec: 0)
|
36
|
-
stop = Time.at(60 * (now.to_i / 60))
|
37
|
-
offset = RailsPerformance::Reports::BaseReport.time_in_app_time_zone(now).utc_offset
|
37
|
+
stop = now # Time.at(60 * (now.to_i / 60), in:)
|
38
|
+
offset = 0 # RailsPerformance::Reports::BaseReport.time_in_app_time_zone(now).utc_offset
|
38
39
|
current = stop - RailsPerformance.duration
|
39
40
|
|
40
41
|
@data = []
|
@@ -48,7 +49,7 @@ module RailsPerformance
|
|
48
49
|
while current <= stop
|
49
50
|
key = current.strftime(RailsPerformance::FORMAT)
|
50
51
|
views = all[key].presence || 0
|
51
|
-
@data << [(current.to_i + offset) * 1000, views.
|
52
|
+
@data << [(current.to_i + offset) * 1000, views.round(2)]
|
52
53
|
current += 1.minute
|
53
54
|
end
|
54
55
|
|
@@ -62,14 +63,14 @@ module RailsPerformance
|
|
62
63
|
# 1732125550000 => 0,
|
63
64
|
# ....
|
64
65
|
# }
|
65
|
-
def nil_data
|
66
|
+
def nil_data(duration = RailsPerformance.duration)
|
66
67
|
@nil_data ||= begin
|
67
68
|
result = {}
|
68
|
-
now =
|
69
|
+
now = RailsPerformance::Utils.time
|
69
70
|
now = now.change(sec: 0, usec: 0)
|
70
|
-
stop = Time.at(60 * (now.to_i / 60))
|
71
|
-
offset = RailsPerformance::Reports::BaseReport.time_in_app_time_zone(now).utc_offset
|
72
|
-
current = stop -
|
71
|
+
stop = now # Time.at(60 * (now.to_i / 60))
|
72
|
+
offset = 0 # RailsPerformance::Reports::BaseReport.time_in_app_time_zone(now).utc_offset
|
73
|
+
current = stop - duration
|
73
74
|
|
74
75
|
while current <= stop
|
75
76
|
current.strftime(RailsPerformance::FORMAT)
|
@@ -85,8 +86,8 @@ module RailsPerformance
|
|
85
86
|
# 1732125540000 => 1,
|
86
87
|
# 1732125550000 => 0,
|
87
88
|
# }
|
88
|
-
def nullify_data(input)
|
89
|
-
nil_data.merge(input).sort
|
89
|
+
def nullify_data(input, duration = RailsPerformance.duration)
|
90
|
+
nil_data(duration).merge(input).sort
|
90
91
|
end
|
91
92
|
end
|
92
93
|
end
|
@@ -1,24 +1,17 @@
|
|
1
1
|
module RailsPerformance
|
2
2
|
module Reports
|
3
3
|
class ResourcesReport < BaseReport
|
4
|
-
def self.x
|
5
|
-
@datasource = RailsPerformance::DataSource.new(type: :resources)
|
6
|
-
db = @datasource.db
|
7
|
-
@data = RailsPerformance::Reports::ResourcesReport.new(db)
|
8
|
-
# RailsPerformance::Reports::ResourcesReport.x
|
9
|
-
end
|
10
|
-
|
11
4
|
def data
|
12
5
|
@data ||= db.data
|
13
6
|
.collect { |e| e.record_hash }
|
14
7
|
.group_by { |e| e[:server] + "///" + e[:context] + "///" + e[:role] }
|
15
|
-
.transform_values { |v| v.sort { |a, b| b[sort] <=> a[sort] } }
|
8
|
+
# .transform_values { |v| v.sort { |a, b| b[sort] <=> a[sort] } }
|
16
9
|
.transform_values { |v| v.map { |e| e.merge({datetimei: e[:datetimei].to_i}) } }
|
17
10
|
end
|
18
11
|
|
19
12
|
def cpu
|
20
13
|
@cpu ||= data.transform_values do |v|
|
21
|
-
|
14
|
+
prepare_report(v.each_with_object({}) do |e, res|
|
22
15
|
res[e[:datetimei] * 1000] = e[:cpu]["one_min"].to_f.round(2)
|
23
16
|
end)
|
24
17
|
end
|
@@ -26,7 +19,7 @@ module RailsPerformance
|
|
26
19
|
|
27
20
|
def memory
|
28
21
|
@memory ||= data.transform_values do |v|
|
29
|
-
|
22
|
+
prepare_report(v.each_with_object({}) do |e, res|
|
30
23
|
res[e[:datetimei] * 1000] = e[:memory].to_f.round(2)
|
31
24
|
end)
|
32
25
|
end
|
@@ -34,11 +27,17 @@ module RailsPerformance
|
|
34
27
|
|
35
28
|
def disk
|
36
29
|
@disk ||= data.transform_values do |v|
|
37
|
-
|
30
|
+
prepare_report(v.each_with_object({}) do |e, res|
|
38
31
|
res[e[:datetimei] * 1000] = e[:disk]["available"].to_f.round(2)
|
39
32
|
end)
|
40
33
|
end
|
41
34
|
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def prepare_report(input)
|
39
|
+
nullify_data(input, RailsPerformance.system_monitor_duration)
|
40
|
+
end
|
42
41
|
end
|
43
42
|
end
|
44
43
|
end
|
@@ -1,5 +1,13 @@
|
|
1
1
|
module RailsPerformance
|
2
2
|
class Utils
|
3
|
+
def self.time
|
4
|
+
Time.now.utc
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.from_datetimei(datetimei)
|
8
|
+
Time.at(datetimei, in: "+00:00")
|
9
|
+
end
|
10
|
+
|
3
11
|
# date key in redis store
|
4
12
|
def self.cache_key(now = Date.today)
|
5
13
|
"date-#{now}"
|
@@ -7,7 +15,7 @@ module RailsPerformance
|
|
7
15
|
|
8
16
|
# write to current slot
|
9
17
|
# time - date -minute
|
10
|
-
def self.field_key(now =
|
18
|
+
def self.field_key(now = RailsPerformance::Utils.time)
|
11
19
|
now.strftime("%H:%M")
|
12
20
|
end
|
13
21
|
|
@@ -32,8 +40,8 @@ module RailsPerformance
|
|
32
40
|
RailsPerformance.redis.set(key, value.to_json, ex: expire.to_i)
|
33
41
|
end
|
34
42
|
|
35
|
-
def self.days
|
36
|
-
(
|
43
|
+
def self.days(duration = RailsPerformance.duration)
|
44
|
+
(duration / 1.day) + 1
|
37
45
|
end
|
38
46
|
|
39
47
|
def self.median(array)
|
data/lib/rails_performance.rb
CHANGED
@@ -119,6 +119,14 @@ module RailsPerformance
|
|
119
119
|
mattr_accessor :ignore_trace_headers
|
120
120
|
@@ignore_trace_headers = ["datetimei"]
|
121
121
|
|
122
|
+
# System monitor duration (expiration time)
|
123
|
+
mattr_accessor :system_monitor_duration
|
124
|
+
@@system_monitor_duration = 24.hours
|
125
|
+
|
126
|
+
# -- internal usage --
|
127
|
+
#
|
128
|
+
#
|
129
|
+
# to store the resource monitor instance
|
122
130
|
mattr_accessor :_resource_monitor
|
123
131
|
@@_resource_monitor = nil
|
124
132
|
|
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.4.0.
|
4
|
+
version: 1.4.0.alpha5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Kasyanchuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|