rails_performance 1.0.0.beta2 → 1.0.0.beta3

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: 136a862da6c0d5b7d7d458e6c5389314cfe776d0437272d319d89a95eeaa8a11
4
- data.tar.gz: 913394396bb6d45c8a9d12d8b2f115bc135cf9fe61eee19c79a3a88165c50551
3
+ metadata.gz: d95736df988ebe718c347259ae72fb5c33a10bd358c1ff5c459188d704ca89b6
4
+ data.tar.gz: 289ad1993e1a0cfb5f52143a5c45d37d898de0be6ef12101b7c2df6dde3d8966
5
5
  SHA512:
6
- metadata.gz: 4e07938ad437c12dfc911ca66d06717eded983694436b9936bc038876c685bcd9bc432c42ddc35279eb96e5511220781d790f3322f1f1acd6cfce4cce1fc27c2
7
- data.tar.gz: 6fd601401eba7c250a31481df0f4bf1bf92c5d856ea9f5c454f3eefd45fbccc669fb1f088538a2a56a0a0decf5627eb87b2e1e93557b0515fd34ee0b575608df
6
+ metadata.gz: 841415e9db06b9cbc2fc820a349410b5d140b3bedb11731ba56d1359892f2226a732768cb908ebc1085bcca4bbd3653d1f49ebc3f6679aedb586df84a320c049
7
+ data.tar.gz: b8730fe25499f7303e28e900417ce759fc421adc95a2adab4142fac2bf7d30f90c847399fa442a1b1f0d42087f097ef74496f8d5531776221578100c889b94f8
@@ -6,20 +6,20 @@ module RailsPerformance
6
6
 
7
7
  if RailsPerformance.enabled
8
8
  def index
9
- @datasource = RP::DataSource.new(**prepare_query, type: :requests)
9
+ @datasource = RailsPerformance::DataSource.new(**prepare_query, type: :requests)
10
10
  db = @datasource.db
11
11
 
12
- @throughput_report_data = RP::Reports::ThroughputReport.new(db).data
13
- @response_time_report_data = RP::Reports::ResponseTimeReport.new(db).data
12
+ @throughput_report_data = RailsPerformance::Reports::ThroughputReport.new(db).data
13
+ @response_time_report_data = RailsPerformance::Reports::ResponseTimeReport.new(db).data
14
14
  end
15
15
 
16
16
  def summary
17
- @datasource = RP::DataSource.new(**prepare_query, type: :requests)
17
+ @datasource = RailsPerformance::DataSource.new(**prepare_query, type: :requests)
18
18
  db = @datasource.db
19
19
 
20
- @throughput_report_data = RP::Reports::ThroughputReport.new(db).data
21
- @response_time_report_data = RP::Reports::ResponseTimeReport.new(db).data
22
- @data = RP::Reports::BreakdownReport.new(db, title: "Requests").data
20
+ @throughput_report_data = RailsPerformance::Reports::ThroughputReport.new(db).data
21
+ @response_time_report_data = RailsPerformance::Reports::ResponseTimeReport.new(db).data
22
+ @data = RailsPerformance::Reports::BreakdownReport.new(db, title: "Requests").data
23
23
 
24
24
  respond_to do |format|
25
25
  format.js {}
@@ -28,8 +28,8 @@ module RailsPerformance
28
28
  end
29
29
 
30
30
  def trace
31
- @record = RP::Models::RequestRecord.find_by(request_id: params[:id])
32
- @data = RP::Reports::TraceReport.new(request_id: params[:id]).data
31
+ @record = RailsPerformance::Models::RequestRecord.find_by(request_id: params[:id])
32
+ @data = RailsPerformance::Reports::TraceReport.new(request_id: params[:id]).data
33
33
  respond_to do |format|
34
34
  format.js {}
35
35
  format.any { render plain: "Doesn't open in new window. Wait until full page load." }
@@ -37,65 +37,65 @@ module RailsPerformance
37
37
  end
38
38
 
39
39
  def crashes
40
- @datasource = RP::DataSource.new(**prepare_query({status_eq: 500}), type: :requests)
40
+ @datasource = RailsPerformance::DataSource.new(**prepare_query({status_eq: 500}), type: :requests)
41
41
  db = @datasource.db
42
- @data = RP::Reports::CrashReport.new(db).data
42
+ @data = RailsPerformance::Reports::CrashReport.new(db).data
43
43
  end
44
44
 
45
45
  def requests
46
- @datasource = RP::DataSource.new(**prepare_query, type: :requests)
46
+ @datasource = RailsPerformance::DataSource.new(**prepare_query, type: :requests)
47
47
  db = @datasource.db
48
- @data = RP::Reports::RequestsReport.new(db, group: :controller_action_format, sort: :count).data
48
+ @data = RailsPerformance::Reports::RequestsReport.new(db, group: :controller_action_format, sort: :count).data
49
49
  end
50
50
 
51
51
  def recent
52
- @datasource = RP::DataSource.new(**prepare_query, type: :requests)
52
+ @datasource = RailsPerformance::DataSource.new(**prepare_query, type: :requests)
53
53
  db = @datasource.db
54
- @data = RP::Reports::RecentRequestsReport.new(db).data
54
+ @data = RailsPerformance::Reports::RecentRequestsReport.new(db).data
55
55
  end
56
56
 
57
57
  def sidekiq
58
- @datasource = RP::DataSource.new(**prepare_query, type: :sidekiq)
58
+ @datasource = RailsPerformance::DataSource.new(**prepare_query, type: :sidekiq)
59
59
  db = @datasource.db
60
- @throughput_report_data = RP::Reports::ThroughputReport.new(db).data
61
- @response_time_report_data = RP::Reports::ResponseTimeReport.new(db).data
62
- @recent_report_data = RP::Reports::RecentRequestsReport.new(db).data
60
+ @throughput_report_data = RailsPerformance::Reports::ThroughputReport.new(db).data
61
+ @response_time_report_data = RailsPerformance::Reports::ResponseTimeReport.new(db).data
62
+ @recent_report_data = RailsPerformance::Reports::RecentRequestsReport.new(db).data
63
63
  end
64
64
 
65
65
  def delayed_job
66
- @datasource = RP::DataSource.new(**prepare_query, type: :delayed_job)
66
+ @datasource = RailsPerformance::DataSource.new(**prepare_query, type: :delayed_job)
67
67
  db = @datasource.db
68
- @throughput_report_data = RP::Reports::ThroughputReport.new(db).data
69
- @response_time_report_data = RP::Reports::ResponseTimeReport.new(db).data
70
- @recent_report_data = RP::Reports::RecentRequestsReport.new(db).data
68
+ @throughput_report_data = RailsPerformance::Reports::ThroughputReport.new(db).data
69
+ @response_time_report_data = RailsPerformance::Reports::ResponseTimeReport.new(db).data
70
+ @recent_report_data = RailsPerformance::Reports::RecentRequestsReport.new(db).data
71
71
  end
72
72
 
73
73
  def custom
74
- @datasource = RP::DataSource.new(**prepare_query, type: :custom)
74
+ @datasource = RailsPerformance::DataSource.new(**prepare_query, type: :custom)
75
75
  db = @datasource.db
76
- @throughput_report_data = RP::Reports::ThroughputReport.new(db).data
77
- @response_time_report_data = RP::Reports::ResponseTimeReport.new(db).data
78
- @recent_report_data = RP::Reports::RecentRequestsReport.new(db).data
76
+ @throughput_report_data = RailsPerformance::Reports::ThroughputReport.new(db).data
77
+ @response_time_report_data = RailsPerformance::Reports::ResponseTimeReport.new(db).data
78
+ @recent_report_data = RailsPerformance::Reports::RecentRequestsReport.new(db).data
79
79
  end
80
80
 
81
81
  def grape
82
- @datasource = RP::DataSource.new(**prepare_query, type: :grape)
82
+ @datasource = RailsPerformance::DataSource.new(**prepare_query, type: :grape)
83
83
  db = @datasource.db
84
- @throughput_report_data = RP::Reports::ThroughputReport.new(db).data
85
- @recent_report_data = RP::Reports::RecentRequestsReport.new(db).data
84
+ @throughput_report_data = RailsPerformance::Reports::ThroughputReport.new(db).data
85
+ @recent_report_data = RailsPerformance::Reports::RecentRequestsReport.new(db).data
86
86
  end
87
87
 
88
88
  def rake
89
- @datasource = RP::DataSource.new(**prepare_query, type: :rake)
89
+ @datasource = RailsPerformance::DataSource.new(**prepare_query, type: :rake)
90
90
  db = @datasource.db
91
- @throughput_report_data = RP::Reports::ThroughputReport.new(db).data
92
- @recent_report_data = RP::Reports::RecentRequestsReport.new(db).data
91
+ @throughput_report_data = RailsPerformance::Reports::ThroughputReport.new(db).data
92
+ @recent_report_data = RailsPerformance::Reports::RecentRequestsReport.new(db).data
93
93
  end
94
94
 
95
95
  private
96
96
 
97
97
  def prepare_query(query = params)
98
- RP::Rails::QueryBuilder.compose_from(query)
98
+ RailsPerformance::Rails::QueryBuilder.compose_from(query)
99
99
  end
100
100
  end
101
101
 
@@ -19,7 +19,7 @@
19
19
  <%= yield %>
20
20
  <div class="footer-box">
21
21
  © Rails Performance <span class='red'><i class="fas fa-heart"></i></span> <%= link_to 'https://github.com/igorkasyanchuk/rails_performance', 'https://github.com/igorkasyanchuk/rails_performance', target: '_blank' %>
22
- <div class="is-pulled-right">v.<%= RP::VERSION %></div>
22
+ <div class="is-pulled-right">v.<%= RailsPerformance::VERSION %></div>
23
23
  </div>
24
24
  </div>
25
25
  </section>
@@ -86,8 +86,6 @@ module RailsPerformance
86
86
 
87
87
  end
88
88
 
89
- RP = RailsPerformance
90
-
91
89
  require "rails_performance/engine"
92
90
 
93
91
  require_relative './rails_performance/gems/custom_ext.rb'
@@ -19,9 +19,9 @@ module RailsPerformance
19
19
  end
20
20
 
21
21
  def db
22
- result = RP::Models::Collection.new
23
- (RP::Utils.days + 1).times do |e|
24
- RP::DataSource.new(q: self.q.merge({ on: e.days.ago.to_date }), type: type).add_to(result)
22
+ result = RailsPerformance::Models::Collection.new
23
+ (RailsPerformance::Utils.days + 1).times do |e|
24
+ RailsPerformance::DataSource.new(q: self.q.merge({ on: e.days.ago.to_date }), type: type).add_to(result)
25
25
  end
26
26
  result
27
27
  end
@@ -30,7 +30,7 @@ module RailsPerformance
30
30
  @q.keys == [:on]
31
31
  end
32
32
 
33
- def add_to(storage = RP::Models::Collection.new)
33
+ def add_to(storage = RailsPerformance::Models::Collection.new)
34
34
  store do |record|
35
35
  storage.add(record)
36
36
  end
@@ -7,7 +7,7 @@ module RailsPerformance
7
7
 
8
8
  def call(worker, msg, queue)
9
9
  now = Time.now
10
- record = RP::Models::SidekiqRecord.new(
10
+ record = RailsPerformance::Models::SidekiqRecord.new(
11
11
  enqueued_ati: msg['enqueued_at'].to_i,
12
12
  datetimei: msg['created_at'].to_i,
13
13
  jid: msg['jid'],
@@ -5,12 +5,12 @@ module RailsPerformance
5
5
  attr_accessor :view_runtime, :db_runtime, :duration, :http_referer
6
6
 
7
7
  def RequestRecord.find_by(request_id:)
8
- keys, values = RP::Utils.fetch_from_redis("performance|*|request_id|#{request_id}|*")
8
+ keys, values = RailsPerformance::Utils.fetch_from_redis("performance|*|request_id|#{request_id}|*")
9
9
 
10
10
  return nil if keys.blank?
11
11
  return nil if values.blank?
12
12
 
13
- RP::Models::RequestRecord.from_db(keys[0], values[0])
13
+ RailsPerformance::Models::RequestRecord.from_db(keys[0], values[0])
14
14
  end
15
15
 
16
16
  # key = performance|
@@ -9,7 +9,7 @@ module RailsPerformance
9
9
 
10
10
  def data
11
11
  key = "trace|#{request_id}|END|#{RailsPerformance::SCHEMA}"
12
- JSON.parse(RP.redis.get(key).presence || '[]')
12
+ JSON.parse(RailsPerformance.redis.get(key).presence || '[]')
13
13
  end
14
14
  end
15
15
 
@@ -1,4 +1,4 @@
1
1
  module RailsPerformance
2
- VERSION = '1.0.0.beta2'
2
+ VERSION = '1.0.0.beta3'
3
3
  SCHEMA = '1.0.0'
4
4
  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: 1.0.0.beta2
4
+ version: 1.0.0.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Kasyanchuk