rails_performance 1.5.2 → 1.6.0.pre1
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/Rakefile +2 -3
- data/app/controllers/rails_performance/base_controller.rb +3 -0
- data/app/controllers/rails_performance/rails_performance_controller.rb +1 -2
- data/app/engine_assets/javascripts/apex_ext.js +30 -0
- data/app/engine_assets/javascripts/application.js +8 -0
- data/app/engine_assets/javascripts/autoupdate.js +78 -0
- data/app/engine_assets/javascripts/charts.js +193 -0
- data/app/{views/rails_performance → engine_assets}/javascripts/navbar.js +10 -8
- data/app/{views/rails_performance → engine_assets}/javascripts/panel.js +5 -1
- data/app/engine_assets/javascripts/table.js +7 -0
- data/app/{views/rails_performance → engine_assets}/stylesheets/responsive.css +10 -10
- data/app/{views/rails_performance → engine_assets}/stylesheets/style.css +6 -0
- data/app/helpers/rails_performance/rails_performance_helper.rb +0 -8
- data/app/views/rails_performance/_panel.html.erb +4 -2
- data/app/views/rails_performance/layouts/rails_performance.html.erb +16 -8
- data/app/views/rails_performance/rails_performance/_summary.html.erb +4 -2
- data/app/views/rails_performance/rails_performance/custom.html.erb +6 -13
- data/app/views/rails_performance/rails_performance/delayed_job.html.erb +6 -13
- data/app/views/rails_performance/rails_performance/grape.html.erb +3 -9
- data/app/views/rails_performance/rails_performance/index.html.erb +21 -19
- data/app/views/rails_performance/rails_performance/rake.html.erb +3 -9
- data/app/views/rails_performance/rails_performance/recent.html.erb +6 -5
- data/app/views/rails_performance/rails_performance/resources.html.erb +12 -9
- data/app/views/rails_performance/rails_performance/sidekiq.html.erb +6 -13
- data/app/views/rails_performance/rails_performance/slow.html.erb +1 -1
- data/app/views/rails_performance/rails_performance/summary.js.erb +2 -5
- data/lib/rails_performance/engine.rb +4 -0
- data/lib/rails_performance/engine_assets/controller.rb +42 -0
- data/lib/rails_performance/engine_assets/helper.rb +49 -0
- data/lib/rails_performance/engine_assets.rb +90 -0
- data/lib/rails_performance/gems/grape_ext.rb +3 -1
- data/lib/rails_performance/reports/recent_requests_report.rb +2 -2
- data/lib/rails_performance/version.rb +1 -1
- data/lib/rails_performance.rb +3 -0
- metadata +15 -17
- data/app/views/rails_performance/javascripts/_javascripts.html.erb +0 -11
- data/app/views/rails_performance/javascripts/apexcharts.min.js +0 -14
- data/app/views/rails_performance/javascripts/app.js +0 -158
- data/app/views/rails_performance/javascripts/jquery-3.4.1.min.js +0 -2
- data/app/views/rails_performance/javascripts/rails.js +0 -565
- data/app/views/rails_performance/javascripts/stupidtable.min.js +0 -1
- data/app/views/rails_performance/javascripts/table.js +0 -3
- data/app/views/rails_performance/rails_performance/recent.js.erb +0 -3
- data/app/views/rails_performance/stylesheets/_stylesheets.html.erb +0 -4
- data/app/views/rails_performance/stylesheets/bulma.min.css +0 -1
- /data/app/{views/rails_performance → engine_assets}/stylesheets/panel.css +0 -0
|
@@ -2,13 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
<% unless @datasource.default? %>
|
|
4
4
|
<%#= link_to raw("← Back"), rails_performance_path, class: "back_link" %>
|
|
5
|
-
<% end %>
|
|
6
|
-
|
|
7
|
-
<div class="
|
|
8
|
-
<
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
|
|
5
|
+
<% end %>
|
|
6
|
+
|
|
7
|
+
<div class="has-text-right mb-4">
|
|
8
|
+
<rails-performance-autoupdate interval="10s">
|
|
9
|
+
<label id="autoupdate_label">
|
|
10
|
+
<input type="checkbox" /> Auto-update
|
|
11
|
+
</label>
|
|
12
|
+
</rails-performance-autoupdate>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<div class="columns">
|
|
16
|
+
<div class="column">
|
|
17
|
+
<div class="card">
|
|
18
|
+
<div class="card-content">
|
|
19
|
+
<h2 class="subtitle is-size-1"><%= ms @percentile_report_data[:p50] %></h2>
|
|
12
20
|
<p class="content is-size-4">p50</p>
|
|
13
21
|
</div>
|
|
14
22
|
</div>
|
|
@@ -36,7 +44,9 @@
|
|
|
36
44
|
<div class="card">
|
|
37
45
|
<div class="card-content">
|
|
38
46
|
<h2 class="subtitle">Throughput Report</h2>
|
|
39
|
-
<
|
|
47
|
+
<rails-performance-chart id="throughput_report_chart" type="TIR" legend="RPM" units="rpm" class="chart">
|
|
48
|
+
<%= raw @throughput_report_data.to_json %>
|
|
49
|
+
</rails-performance-chart>
|
|
40
50
|
<p class="content is-small">All requests (site visitors, search engines, bots, etc)</p>
|
|
41
51
|
</div>
|
|
42
52
|
</div>
|
|
@@ -46,17 +56,9 @@
|
|
|
46
56
|
<div class="card">
|
|
47
57
|
<div class="card-content">
|
|
48
58
|
<h2 class="subtitle">Average Response Time Report</h2>
|
|
49
|
-
<
|
|
59
|
+
<rails-performance-chart id="response_time_report_chart" type="RT" legend="Response Time" class="chart">
|
|
60
|
+
<%= raw @response_time_report_data.to_json %>
|
|
61
|
+
</rails-performance-chart>
|
|
50
62
|
<p class="content is-small">All requests (site visitors, search engines, bots, etc)</p>
|
|
51
63
|
</div>
|
|
52
64
|
</div>
|
|
53
|
-
|
|
54
|
-
<% content_for :on_load do %>
|
|
55
|
-
<script>
|
|
56
|
-
var data1 = <%= raw @throughput_report_data.to_json %>;
|
|
57
|
-
showTIRChart('throughput_report_chart', data1, ' rpm', 'RPM');
|
|
58
|
-
|
|
59
|
-
var data2 = <%= raw @response_time_report_data.to_json %>;
|
|
60
|
-
showRTChart('response_time_report_chart', data2);
|
|
61
|
-
</script>
|
|
62
|
-
<% end %>
|
|
@@ -41,15 +41,9 @@
|
|
|
41
41
|
<div class="card">
|
|
42
42
|
<div class="card-content">
|
|
43
43
|
<h2 class="subtitle">Rake Throughput Report</h2>
|
|
44
|
-
<
|
|
44
|
+
<rails-performance-chart id="throughput_report_chart" type="TIR" legend="Tasks" units="tasks / minute" class="chart">
|
|
45
|
+
<%= raw @throughput_report_data.to_json %>
|
|
46
|
+
</rails-performance-chart>
|
|
45
47
|
<p class="content is-small">All rake tasks in the application</p>
|
|
46
48
|
</div>
|
|
47
49
|
</div>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<% content_for :on_load do %>
|
|
51
|
-
<script>
|
|
52
|
-
var data1 = <%= raw @throughput_report_data.to_json %>;
|
|
53
|
-
showTIRChart('throughput_report_chart', data1, ' tasks / minute', 'Tasks');
|
|
54
|
-
</script>
|
|
55
|
-
<% end %>
|
|
@@ -7,14 +7,15 @@
|
|
|
7
7
|
<h2 class="subtitle">Recent Requests (last <%= RailsPerformance.recent_requests_time_window / 60 %> minutes)<h2>
|
|
8
8
|
</div>
|
|
9
9
|
<div class="column is-narrow">
|
|
10
|
-
<%= render "export" %>
|
|
10
|
+
<%= render "export" %>
|
|
11
11
|
</div>
|
|
12
12
|
</div>
|
|
13
13
|
<div class="has-text-right">
|
|
14
|
-
<
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
<rails-performance-autoupdate interval="3s">
|
|
15
|
+
<label>
|
|
16
|
+
<input type="checkbox" /> Auto-update
|
|
17
|
+
</label>
|
|
18
|
+
</rails-performance-autoupdate>
|
|
18
19
|
</div>
|
|
19
20
|
<table id="recent" class="table is-fullwidth is-hoverable is-narrow">
|
|
20
21
|
<thead>
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
<title>System Resources</title>
|
|
2
2
|
|
|
3
|
+
<div class="has-text-right mb-4">
|
|
4
|
+
<rails-performance-autoupdate interval="10s">
|
|
5
|
+
<label id="autoupdate_label">
|
|
6
|
+
<input type="checkbox" /> Auto-update
|
|
7
|
+
</label>
|
|
8
|
+
</rails-performance-autoupdate>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
3
11
|
<% @resources_report.servers.each do |server| %>
|
|
4
12
|
<h1 class="title mt-8 pt-8"><%= server.name %></h1>
|
|
5
13
|
|
|
6
|
-
<% server.charts.each
|
|
14
|
+
<% server.charts.each do |chart| %>
|
|
7
15
|
<div class="card">
|
|
8
16
|
<div class="card-content">
|
|
9
17
|
<h2 class="subtitle"><%= chart.subtitle %></h2>
|
|
10
|
-
<
|
|
18
|
+
<rails-performance-chart id="<%= chart.id %>" type="<%= chart.type %>" legend="<%= chart.legend %>" class="chart">
|
|
19
|
+
<%= raw chart.data.to_json %>
|
|
20
|
+
</rails-performance-chart>
|
|
11
21
|
<p class="content is-small"><%= chart.description %></p>
|
|
12
22
|
</div>
|
|
13
23
|
</div>
|
|
14
|
-
|
|
15
24
|
<br>
|
|
16
|
-
|
|
17
|
-
<% content_for :on_load do %>
|
|
18
|
-
<script>
|
|
19
|
-
show<%= chart.type %>Chart('<%= chart.id %>', <%= raw chart.data.to_json %>, '<%= chart.legend %>', <%= index %>);
|
|
20
|
-
</script>
|
|
21
|
-
<% end %>
|
|
22
25
|
<% end %>
|
|
23
26
|
<% end %>
|
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
<div class="card">
|
|
8
8
|
<div class="card-content">
|
|
9
9
|
<h2 class="subtitle">Sidekiq Workers Throughput Report</h2>
|
|
10
|
-
<
|
|
10
|
+
<rails-performance-chart id="throughput_report_chart" type="TIR" legend="Jobs" units="jobs / minute" class="chart">
|
|
11
|
+
<%= raw @throughput_report_data.to_json %>
|
|
12
|
+
</rails-performance-chart>
|
|
11
13
|
<p class="content is-small">All workers in the application</p>
|
|
12
14
|
</div>
|
|
13
15
|
</div>
|
|
@@ -17,7 +19,9 @@
|
|
|
17
19
|
<div class="card">
|
|
18
20
|
<div class="card-content">
|
|
19
21
|
<h2 class="subtitle">Average Execution Time</h2>
|
|
20
|
-
<
|
|
22
|
+
<rails-performance-chart id="response_time_report_chart" type="RT" legend="Response Time" class="chart">
|
|
23
|
+
<%= raw @response_time_report_data.to_json %>
|
|
24
|
+
</rails-performance-chart>
|
|
21
25
|
<p class="content is-small">All workers in the application</p>
|
|
22
26
|
</div>
|
|
23
27
|
</div>
|
|
@@ -61,14 +65,3 @@
|
|
|
61
65
|
</table>
|
|
62
66
|
</div>
|
|
63
67
|
</div>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
<% content_for :on_load do %>
|
|
67
|
-
<script>
|
|
68
|
-
var data1 = <%= raw @throughput_report_data.to_json %>;
|
|
69
|
-
showTIRChart('throughput_report_chart', data1, ' jobs / minute', 'Jobs');
|
|
70
|
-
|
|
71
|
-
var data2 = <%= raw @response_time_report_data.to_json %>;
|
|
72
|
-
showRTChart('response_time_report_chart', data2);
|
|
73
|
-
</script>
|
|
74
|
-
<% end %>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<h2 class="subtitle">Slow Requests (last <%= RailsPerformance.slow_requests_time_window / 60 %> minutes + slower than <%= RailsPerformance.slow_requests_threshold %>ms)<h2>
|
|
8
8
|
</div>
|
|
9
9
|
<div class="column is-narrow">
|
|
10
|
-
<%= render "export" %>
|
|
10
|
+
<%= render "export" %>
|
|
11
11
|
</div>
|
|
12
12
|
</div>
|
|
13
13
|
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
window.panel.header.html(window.panel.close + '<%= j report_name(@datasource.q) %>');
|
|
2
2
|
window.panel.content.html("<%= j render '/rails_performance/rails_performance/summary', title: "Requests" %>");
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var data2 = <%= raw @response_time_report_data.to_json %>;
|
|
8
|
-
showRTChart('response_time_report_chart_mini', data2);
|
|
4
|
+
document.getElementById('throughput_report_chart_mini').updateData(<%= raw @throughput_report_data.to_json %>);
|
|
5
|
+
document.getElementById('response_time_report_chart_mini').updateData(<%= raw @response_time_report_data.to_json %>);
|
|
9
6
|
|
|
10
7
|
showPanel();
|
|
@@ -8,6 +8,10 @@ module RailsPerformance
|
|
|
8
8
|
class Engine < ::Rails::Engine
|
|
9
9
|
isolate_namespace RailsPerformance
|
|
10
10
|
|
|
11
|
+
initializer "rails_performance.engine_assets", before: :set_routes_reloader do
|
|
12
|
+
RailsPerformance.engine_assets = EngineAssets.new(engine: self)
|
|
13
|
+
end
|
|
14
|
+
|
|
11
15
|
initializer "rails_performance.resource_monitor" do
|
|
12
16
|
# check required gems are available
|
|
13
17
|
RailsPerformance._resource_monitor_enabled = !!(defined?(Sys::Filesystem) && defined?(Sys::CPU) && defined?(GetProcessMem))
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
module RailsPerformance
|
|
2
|
+
class EngineAssets
|
|
3
|
+
class Controller < ActionController::Base
|
|
4
|
+
def show
|
|
5
|
+
file_path = safe_file_path
|
|
6
|
+
|
|
7
|
+
if file_path && File.exist?(file_path)
|
|
8
|
+
send_file file_path,
|
|
9
|
+
type: content_type,
|
|
10
|
+
disposition: "inline"
|
|
11
|
+
|
|
12
|
+
fresh_when(etag: File.mtime(file_path), public: true)
|
|
13
|
+
expires_in 1.year, public: true
|
|
14
|
+
else
|
|
15
|
+
head :not_found
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
cattr_accessor :engine_assets
|
|
22
|
+
|
|
23
|
+
def safe_file_path
|
|
24
|
+
requested = params[:file].gsub("..", "")
|
|
25
|
+
format = params[:format] || request.format.symbol.to_s
|
|
26
|
+
engine_assets.asset_path(requested, format)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def content_type
|
|
30
|
+
format = params[:format] || request.format.symbol.to_s
|
|
31
|
+
engine_assets.content_type(format)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Override to allow cross-origin JavaScript embedding
|
|
35
|
+
# This is really dumb because it IS the same origin, but Chrome's import apparently doesn't send the Origin header.
|
|
36
|
+
# Is there a better way to resolve this?
|
|
37
|
+
def verify_same_origin_request
|
|
38
|
+
# no-op
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
module RailsPerformance
|
|
2
|
+
class EngineAssets
|
|
3
|
+
module Helper
|
|
4
|
+
mattr_accessor :engine_assets
|
|
5
|
+
|
|
6
|
+
def engine_asset_url(source, type)
|
|
7
|
+
fingerprint_value = engine_assets.fingerprint(source, type)
|
|
8
|
+
normalized_type = case type.to_s
|
|
9
|
+
when "javascript" then "js"
|
|
10
|
+
when "stylesheet" then "css"
|
|
11
|
+
else type.to_s
|
|
12
|
+
end
|
|
13
|
+
engine_asset_path("#{source}.#{normalized_type}", v: fingerprint_value)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def engine_stylesheet_link_tag(source, **options)
|
|
17
|
+
tag.link(
|
|
18
|
+
rel: "stylesheet",
|
|
19
|
+
href: engine_asset_url(source, "css"),
|
|
20
|
+
**options
|
|
21
|
+
)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def engine_javascript_include_tag(source, **options)
|
|
25
|
+
tag.script(
|
|
26
|
+
src: engine_asset_url(source, "js"),
|
|
27
|
+
**options
|
|
28
|
+
)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def engine_javascript_importmap_tags(entry_point = "application", imports = {})
|
|
32
|
+
assets_root = engine_assets.engine.root.join("app/#{engine_assets.assets_subdir}/javascripts")
|
|
33
|
+
engine_imports = engine_assets.javascript_files.each_with_object({}) do |path, hash|
|
|
34
|
+
relative_path = path.relative_path_from(assets_root).to_s
|
|
35
|
+
key = "#{engine_assets.engine.engine_name}/#{relative_path.sub(/\.js\z/, "")}"
|
|
36
|
+
hash[key] = engine_asset_url(relative_path.sub(/\.js\z/, ""), "js")
|
|
37
|
+
end
|
|
38
|
+
[
|
|
39
|
+
tag.script(type: "importmap") do
|
|
40
|
+
JSON.pretty_generate({"imports" => imports.merge(engine_imports)}).html_safe
|
|
41
|
+
end,
|
|
42
|
+
tag.script(<<~JS.html_safe, type: "module")
|
|
43
|
+
import "#{engine_assets.engine.engine_name}/#{entry_point}"
|
|
44
|
+
JS
|
|
45
|
+
].join("\n").html_safe
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
require "digest/sha2"
|
|
2
|
+
require_relative "engine_assets/controller"
|
|
3
|
+
require_relative "engine_assets/helper"
|
|
4
|
+
|
|
5
|
+
module RailsPerformance
|
|
6
|
+
class EngineAssets
|
|
7
|
+
attr_reader :engine, :assets_subdir
|
|
8
|
+
|
|
9
|
+
def initialize(engine:, assets_subdir: "engine_assets")
|
|
10
|
+
@engine = engine
|
|
11
|
+
@assets_subdir = assets_subdir
|
|
12
|
+
@fingerprints = {}
|
|
13
|
+
draw_routes
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def asset_path(source, type)
|
|
17
|
+
case type.to_s
|
|
18
|
+
when "js", "javascript"
|
|
19
|
+
engine.root.join("app/#{assets_subdir}/javascripts", "#{source}.js")
|
|
20
|
+
when "css", "stylesheet"
|
|
21
|
+
engine.root.join("app/#{assets_subdir}/stylesheets", "#{source}.css")
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def asset_url(source, type)
|
|
26
|
+
fingerprint_value = fingerprint(source, type)
|
|
27
|
+
engine.routes.url_helpers.engine_asset_path("#{source}.#{normalize_type(type)}", v: fingerprint_value)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def fingerprint(source, type)
|
|
31
|
+
cache_key = "#{source}.#{type}"
|
|
32
|
+
|
|
33
|
+
if ::Rails.env.production?
|
|
34
|
+
@fingerprints[cache_key] ||= calculate_fingerprint(source, type)
|
|
35
|
+
else
|
|
36
|
+
calculate_fingerprint(source, type)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def content_type(type)
|
|
41
|
+
case type.to_s
|
|
42
|
+
when "js", "javascript"
|
|
43
|
+
"application/javascript"
|
|
44
|
+
when "css", "stylesheet"
|
|
45
|
+
"text/css"
|
|
46
|
+
else
|
|
47
|
+
"application/octet-stream"
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def javascript_files
|
|
52
|
+
engine.root.glob("app/#{assets_subdir}/javascripts/**/*.js")
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def helper
|
|
56
|
+
Helper.engine_assets = self
|
|
57
|
+
Helper
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
private
|
|
61
|
+
|
|
62
|
+
def draw_routes
|
|
63
|
+
Controller.engine_assets = self
|
|
64
|
+
engine.routes.prepend do
|
|
65
|
+
get "/assets/*file", to: Controller.action(:show), as: :engine_asset
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def normalize_type(type)
|
|
70
|
+
case type.to_s
|
|
71
|
+
when "javascript"
|
|
72
|
+
"js"
|
|
73
|
+
when "stylesheet"
|
|
74
|
+
"css"
|
|
75
|
+
else
|
|
76
|
+
type.to_s
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def calculate_fingerprint(source, type)
|
|
81
|
+
file_path = asset_path(source, type)
|
|
82
|
+
|
|
83
|
+
if file_path && File.exist?(file_path)
|
|
84
|
+
Digest::SHA256.file(file_path).hexdigest[0...8]
|
|
85
|
+
else
|
|
86
|
+
"missing"
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
@@ -23,7 +23,9 @@ module RailsPerformance
|
|
|
23
23
|
CurrentRequest.current.record.path = payload[:env]["PATH_INFO"]
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
expects_no_content = Rack::Utils::STATUS_WITH_NO_ENTITY_BODY.include?(CurrentRequest.current.record.status)
|
|
27
|
+
if name == "format_response.grape" ||
|
|
28
|
+
(name == "endpoint_run.grape" && (payload[:endpoint]&.body.nil? || expects_no_content))
|
|
27
29
|
CurrentRequest.current.record.save
|
|
28
30
|
CurrentRequest.cleanup
|
|
29
31
|
end
|
|
@@ -5,8 +5,8 @@ module RailsPerformance
|
|
|
5
5
|
@sort ||= :datetimei
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
def data
|
|
9
|
-
time_agoi =
|
|
8
|
+
def data
|
|
9
|
+
time_agoi = RailsPerformance.recent_requests_time_window.ago.to_i
|
|
10
10
|
db.data
|
|
11
11
|
.collect { |e| e.record_hash }
|
|
12
12
|
.select { |e| e if e[sort] > time_agoi }
|
data/lib/rails_performance.rb
CHANGED
|
@@ -31,6 +31,7 @@ require_relative "rails_performance/events/record"
|
|
|
31
31
|
require_relative "rails_performance/extensions/trace"
|
|
32
32
|
require_relative "rails_performance/thread/current_request"
|
|
33
33
|
require_relative "rails_performance/interface"
|
|
34
|
+
require_relative "rails_performance/engine_assets"
|
|
34
35
|
|
|
35
36
|
module RailsPerformance
|
|
36
37
|
extend RailsPerformance::Interface
|
|
@@ -153,6 +154,8 @@ module RailsPerformance
|
|
|
153
154
|
mattr_accessor :_resource_monitor_enabled
|
|
154
155
|
@@_resource_monitor_enabled = false
|
|
155
156
|
|
|
157
|
+
mattr_accessor :engine_assets
|
|
158
|
+
|
|
156
159
|
def self.setup
|
|
157
160
|
yield(self)
|
|
158
161
|
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.
|
|
4
|
+
version: 1.6.0.pre1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Igor Kasyanchuk
|
|
@@ -304,17 +304,18 @@ files:
|
|
|
304
304
|
- app/controllers/rails_performance/base_controller.rb
|
|
305
305
|
- app/controllers/rails_performance/concerns/csv_exportable.rb
|
|
306
306
|
- app/controllers/rails_performance/rails_performance_controller.rb
|
|
307
|
+
- app/engine_assets/javascripts/apex_ext.js
|
|
308
|
+
- app/engine_assets/javascripts/application.js
|
|
309
|
+
- app/engine_assets/javascripts/autoupdate.js
|
|
310
|
+
- app/engine_assets/javascripts/charts.js
|
|
311
|
+
- app/engine_assets/javascripts/navbar.js
|
|
312
|
+
- app/engine_assets/javascripts/panel.js
|
|
313
|
+
- app/engine_assets/javascripts/table.js
|
|
314
|
+
- app/engine_assets/stylesheets/panel.css
|
|
315
|
+
- app/engine_assets/stylesheets/responsive.css
|
|
316
|
+
- app/engine_assets/stylesheets/style.css
|
|
307
317
|
- app/helpers/rails_performance/rails_performance_helper.rb
|
|
308
318
|
- app/views/rails_performance/_panel.html.erb
|
|
309
|
-
- app/views/rails_performance/javascripts/_javascripts.html.erb
|
|
310
|
-
- app/views/rails_performance/javascripts/apexcharts.min.js
|
|
311
|
-
- app/views/rails_performance/javascripts/app.js
|
|
312
|
-
- app/views/rails_performance/javascripts/jquery-3.4.1.min.js
|
|
313
|
-
- app/views/rails_performance/javascripts/navbar.js
|
|
314
|
-
- app/views/rails_performance/javascripts/panel.js
|
|
315
|
-
- app/views/rails_performance/javascripts/rails.js
|
|
316
|
-
- app/views/rails_performance/javascripts/stupidtable.min.js
|
|
317
|
-
- app/views/rails_performance/javascripts/table.js
|
|
318
319
|
- app/views/rails_performance/layouts/rails_performance.html.erb
|
|
319
320
|
- app/views/rails_performance/rails_performance/_export.html.erb
|
|
320
321
|
- app/views/rails_performance/rails_performance/_recent_row.html.erb
|
|
@@ -327,7 +328,6 @@ files:
|
|
|
327
328
|
- app/views/rails_performance/rails_performance/index.html.erb
|
|
328
329
|
- app/views/rails_performance/rails_performance/rake.html.erb
|
|
329
330
|
- app/views/rails_performance/rails_performance/recent.html.erb
|
|
330
|
-
- app/views/rails_performance/rails_performance/recent.js.erb
|
|
331
331
|
- app/views/rails_performance/rails_performance/requests.html.erb
|
|
332
332
|
- app/views/rails_performance/rails_performance/resources.html.erb
|
|
333
333
|
- app/views/rails_performance/rails_performance/sidekiq.html.erb
|
|
@@ -335,11 +335,6 @@ files:
|
|
|
335
335
|
- app/views/rails_performance/rails_performance/summary.js.erb
|
|
336
336
|
- app/views/rails_performance/rails_performance/trace.js.erb
|
|
337
337
|
- app/views/rails_performance/shared/_header.html.erb
|
|
338
|
-
- app/views/rails_performance/stylesheets/_stylesheets.html.erb
|
|
339
|
-
- app/views/rails_performance/stylesheets/bulma.min.css
|
|
340
|
-
- app/views/rails_performance/stylesheets/panel.css
|
|
341
|
-
- app/views/rails_performance/stylesheets/responsive.css
|
|
342
|
-
- app/views/rails_performance/stylesheets/style.css
|
|
343
338
|
- config/routes.rb
|
|
344
339
|
- lib/generators/rails_performance/install/USAGE
|
|
345
340
|
- lib/generators/rails_performance/install/install_generator.rb
|
|
@@ -347,6 +342,9 @@ files:
|
|
|
347
342
|
- lib/rails_performance.rb
|
|
348
343
|
- lib/rails_performance/data_source.rb
|
|
349
344
|
- lib/rails_performance/engine.rb
|
|
345
|
+
- lib/rails_performance/engine_assets.rb
|
|
346
|
+
- lib/rails_performance/engine_assets/controller.rb
|
|
347
|
+
- lib/rails_performance/engine_assets/helper.rb
|
|
350
348
|
- lib/rails_performance/events/record.rb
|
|
351
349
|
- lib/rails_performance/extensions/trace.rb
|
|
352
350
|
- lib/rails_performance/gems/custom_ext.rb
|
|
@@ -403,7 +401,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
403
401
|
- !ruby/object:Gem::Version
|
|
404
402
|
version: '0'
|
|
405
403
|
requirements: []
|
|
406
|
-
rubygems_version: 3.
|
|
404
|
+
rubygems_version: 3.7.2
|
|
407
405
|
specification_version: 4
|
|
408
406
|
summary: Simple Rails Performance tracker. Alternative to the NewRelic, Datadog or
|
|
409
407
|
other services.
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<%= insert_js_file 'jquery-3.4.1.min.js' %>
|
|
2
|
-
<%= insert_js_file 'rails.js' %>
|
|
3
|
-
<%= insert_js_file 'stupidtable.min.js' %>
|
|
4
|
-
<%= insert_js_file 'apexcharts.min.js' %>
|
|
5
|
-
|
|
6
|
-
<%= javascript_include_tag 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/js/all.min.js' %>
|
|
7
|
-
|
|
8
|
-
<%= insert_js_file 'app.js' %>
|
|
9
|
-
<%= insert_js_file 'panel.js' %>
|
|
10
|
-
<%= insert_js_file 'table.js' %>
|
|
11
|
-
<%= insert_js_file 'navbar.js' %>
|