rails_performance 0.0.1 → 0.0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/rails_performance/_js.html.erb +3 -0
- data/lib/rails_performance/data_source.rb +2 -2
- data/lib/rails_performance/middleware.rb +5 -5
- data/lib/rails_performance/throughput_report.rb +2 -1
- data/lib/rails_performance/utils.rb +3 -2
- data/lib/rails_performance/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51b705efba63ca09c41d8d2bae1ca38a24ac5b61d02ebf04900b32e4741b6715
|
4
|
+
data.tar.gz: 738cf597eebf005575d85c9054ea1cbb75d61d60a814ad53c12d782b053b4388
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a37ee64f11e1670baef0eeeb42ab5d926851f29351a027cecdfcc1ef618f603fd08456e1aaeaae0262179b79a930fe6bbbd5a04995bda83dcdfb0a56b7e2e3f8
|
7
|
+
data.tar.gz: c2fdee215cef0eb8f070c9249f1d4ffc518ae069d96128bb65e7414dbf4888204d48a6b50a5836919efc7ec98337ee81c20e99f45693670c2e59a9cca65d00ba
|
@@ -3,7 +3,7 @@ module RailsPerformance
|
|
3
3
|
attr_reader :q
|
4
4
|
|
5
5
|
def initialize(q: {})
|
6
|
-
q[:on] ||= Date.
|
6
|
+
q[:on] ||= Date.today
|
7
7
|
@q = q
|
8
8
|
end
|
9
9
|
|
@@ -24,7 +24,7 @@ module RailsPerformance
|
|
24
24
|
alias :add_to :db
|
25
25
|
|
26
26
|
def store
|
27
|
-
#puts "REDIS
|
27
|
+
#puts "\n\n [REDIS] --> #{query}\n\n"
|
28
28
|
|
29
29
|
keys = RP.redis.keys(query)
|
30
30
|
return [] if keys.blank?
|
@@ -7,11 +7,11 @@ module RailsPerformance
|
|
7
7
|
def call(env)
|
8
8
|
@status, @headers, @response = @app.call(env)
|
9
9
|
|
10
|
-
record = Thread.current["RP_request_info"]
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
if record = Thread.current["RP_request_info"]
|
11
|
+
record[:status] ||= @status
|
12
|
+
RP::Utils.log_in_redis(record)
|
13
|
+
Thread.current["RP_request_info"] = nil
|
14
|
+
end
|
15
15
|
|
16
16
|
[@status, @headers, @response]
|
17
17
|
end
|
@@ -10,6 +10,7 @@ module RailsPerformance
|
|
10
10
|
stop = Time.at(60 * (Time.now.to_i / 60))
|
11
11
|
current = stop - RailsPerformance.duration
|
12
12
|
@data = []
|
13
|
+
offset = Time.current.utc_offset
|
13
14
|
|
14
15
|
# read current values
|
15
16
|
db.group_by(group).values.each do |(k, v)|
|
@@ -19,7 +20,7 @@ module RailsPerformance
|
|
19
20
|
# add blank columns
|
20
21
|
while current <= stop
|
21
22
|
views = all[current.strftime(MetricsListener::FORMAT)] || 0
|
22
|
-
@data << [current.to_i * 1000, views.to_i]
|
23
|
+
@data << [(current.to_i + offset) * 1000, views.to_i]
|
23
24
|
current += 1.minute
|
24
25
|
end
|
25
26
|
|
@@ -2,7 +2,7 @@ module RailsPerformance
|
|
2
2
|
|
3
3
|
class Utils
|
4
4
|
# date key in redis store
|
5
|
-
def Utils.cache_key(now = Date.
|
5
|
+
def Utils.cache_key(now = Date.today)
|
6
6
|
"date-#{now}"
|
7
7
|
end
|
8
8
|
|
@@ -16,7 +16,8 @@ module RailsPerformance
|
|
16
16
|
value = e.slice(:view_runtime, :db_runtime, :duration)
|
17
17
|
key = "performance|controller|#{e[:controller]}|action|#{e[:action]}|format|#{e[:format]}|status|#{e[:status]}|datetime|#{e[:datetime]}|datetimei|#{e[:datetimei]}|method|#{e[:method]}|path|#{e[:path]}|END"
|
18
18
|
|
19
|
-
#puts " [SAVE] ---> #{key}
|
19
|
+
#puts " [SAVE] key ---> #{key}\n"
|
20
|
+
#puts " value ---> #{value.to_json}\n\n"
|
20
21
|
|
21
22
|
RP.redis.set(key, value.to_json)
|
22
23
|
RP.redis.expire(key, RP.duration.to_i)
|