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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 92b728bc962cef29c1e505e925bd149da93a27e97ae1663ee694bf08109d6681
4
- data.tar.gz: 5188f58ab04ad5172fa4c18e320f938e829baf5e48bd4ce0eb6b6f9fe1862d60
3
+ metadata.gz: 51b705efba63ca09c41d8d2bae1ca38a24ac5b61d02ebf04900b32e4741b6715
4
+ data.tar.gz: 738cf597eebf005575d85c9054ea1cbb75d61d60a814ad53c12d782b053b4388
5
5
  SHA512:
6
- metadata.gz: 8ea76771978cc52ba1411379c9d71d5abdb617d20718c7bcefa39a4ff9d6f27cfc91f5ca8fe335cf57b469458d00d460fc1034a7a1612876dce14b41ceb0c5e5
7
- data.tar.gz: c27e7c74b92c6e91299f76dedbb5c7e776f7929c71695030a6b21216ca3d55acc39dd9e95bf51b02973a90704c853fa8a29f21b6ed52a4efa2e38e0bf3f2c8d2
6
+ metadata.gz: a37ee64f11e1670baef0eeeb42ab5d926851f29351a027cecdfcc1ef618f603fd08456e1aaeaae0262179b79a930fe6bbbd5a04995bda83dcdfb0a56b7e2e3f8
7
+ data.tar.gz: c2fdee215cef0eb8f070c9249f1d4ffc518ae069d96128bb65e7414dbf4888204d48a6b50a5836919efc7ec98337ee81c20e99f45693670c2e59a9cca65d00ba
@@ -7,6 +7,9 @@
7
7
  <script>
8
8
  function showRequestsChart(div, data) {
9
9
  Highcharts.chart(div, {
10
+ time: {
11
+ timezone: 'Europe/Kiev'
12
+ },
10
13
  chart: {
11
14
  type: 'column',
12
15
  zoomType: 'x',
@@ -3,7 +3,7 @@ module RailsPerformance
3
3
  attr_reader :q
4
4
 
5
5
  def initialize(q: {})
6
- q[:on] ||= Date.current
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: #{query}"
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
- record[:status] ||= @status
13
-
14
- RP::Utils.log_in_redis(record)
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.current)
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} = #{value.to_json}\n\n"
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)
@@ -1,3 +1,3 @@
1
1
  module RailsPerformance
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_performance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Kasyanchuk