rails_performance 1.4.0 → 1.4.1.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/app/views/rails_performance/javascripts/_javascripts.html.erb +1 -5
- data/app/views/rails_performance/javascripts/apexcharts.min.js +14 -0
- data/app/views/rails_performance/javascripts/app.js +105 -329
- data/app/views/rails_performance/layouts/rails_performance.html.erb +0 -3
- data/app/views/rails_performance/rails_performance/resources.html.erb +3 -3
- data/app/views/rails_performance/stylesheets/style.css +4 -0
- data/lib/rails_performance/data_source.rb +1 -1
- data/lib/rails_performance/gems/rake_ext.rb +2 -0
- data/lib/rails_performance/version.rb +1 -1
- metadata +3 -2
@@ -1,349 +1,125 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
function showTIRChart(div, data, addon, name) {
|
8
|
-
Highcharts.chart(div, {
|
1
|
+
function showChart(element_id, type, title, options) {
|
2
|
+
const chart = new ApexCharts(
|
3
|
+
document.getElementById(element_id),
|
4
|
+
{
|
5
|
+
...options,
|
9
6
|
chart: {
|
10
|
-
|
11
|
-
|
7
|
+
type: type,
|
8
|
+
height: 300,
|
9
|
+
zoom: {
|
10
|
+
type: 'x',
|
11
|
+
},
|
12
12
|
},
|
13
|
-
|
14
|
-
|
13
|
+
colors: ['#ff5b5b'],
|
14
|
+
stroke: {
|
15
|
+
width: 1,
|
15
16
|
},
|
16
|
-
|
17
|
-
|
18
|
-
backgroundColor: 'yellow',
|
19
|
-
pointFormat: '{point.y}',
|
20
|
-
//headerFormat: '',
|
21
|
-
shadow: false,
|
22
|
-
style: {
|
23
|
-
fontSize: '16px',
|
24
|
-
color: '#000',
|
25
|
-
},
|
26
|
-
formatter: function() {
|
27
|
-
if (this.y == 0) {
|
28
|
-
return false;
|
29
|
-
}
|
30
|
-
return this.y + addon;
|
31
|
-
}
|
32
|
-
},
|
33
|
-
xAxis: {
|
34
|
-
crosshair: true,
|
35
|
-
type: 'datetime',
|
36
|
-
labels: {
|
37
|
-
style: {
|
38
|
-
color: "#a6b0cf"
|
39
|
-
}
|
40
|
-
}
|
41
|
-
},
|
42
|
-
yAxis: {
|
43
|
-
min: 0,
|
44
|
-
title: {
|
45
|
-
text: 'RPM',
|
46
|
-
style: {
|
47
|
-
color: "#f6f6f6"
|
48
|
-
}
|
49
|
-
},
|
50
|
-
labels: {
|
51
|
-
style: {
|
52
|
-
color: "#a6b0cf"
|
53
|
-
}
|
54
|
-
}
|
17
|
+
dataLabels: {
|
18
|
+
enabled: false
|
55
19
|
},
|
56
20
|
legend: {
|
57
|
-
|
58
|
-
},
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
21
|
+
show: false
|
22
|
+
},
|
23
|
+
xaxis: {
|
24
|
+
crosshairs: {
|
25
|
+
show: true
|
26
|
+
},
|
27
|
+
type: 'datetime',
|
28
|
+
labels: {
|
29
|
+
datetimeUTC: false,
|
30
|
+
style: {
|
31
|
+
colors: ["#a6b0cf"]
|
65
32
|
}
|
66
33
|
}
|
67
34
|
},
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
},
|
73
|
-
series: [{
|
74
|
-
type: 'area',
|
75
|
-
name: name,
|
76
|
-
data: data,
|
77
|
-
fillOpacity: 0.3,
|
78
|
-
lineWidth: 1,
|
79
|
-
states: {
|
80
|
-
hover: {
|
81
|
-
lineWidth: 1
|
82
|
-
}
|
83
|
-
}
|
84
|
-
}]
|
85
|
-
});
|
86
|
-
};
|
87
|
-
|
88
|
-
function showRTChart(div, data) {
|
89
|
-
Highcharts.chart(div, {
|
90
|
-
chart: {
|
91
|
-
type: 'area',
|
92
|
-
zoomType: 'x',
|
93
|
-
},
|
94
|
-
title: {
|
95
|
-
text: ''
|
96
|
-
},
|
97
|
-
|
98
|
-
tooltip: {
|
99
|
-
borderWidth: 0,
|
100
|
-
backgroundColor: 'yellow',
|
101
|
-
pointFormat: '{point.y}',
|
102
|
-
//headerFormat: '',
|
103
|
-
shadow: false,
|
35
|
+
yaxis: {
|
36
|
+
min: 0,
|
37
|
+
title: {
|
38
|
+
text: title,
|
104
39
|
style: {
|
105
|
-
|
106
|
-
color: '#000',
|
107
|
-
},
|
108
|
-
formatter: function() {
|
109
|
-
if (this.y == 0) {
|
110
|
-
return false;
|
111
|
-
}
|
112
|
-
return this.y + ' ms';
|
40
|
+
color: "#f6f6f6"
|
113
41
|
}
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
labels: {
|
119
|
-
style: {
|
120
|
-
color: "#a6b0cf"
|
121
|
-
}
|
122
|
-
}
|
123
|
-
},
|
124
|
-
yAxis: {
|
125
|
-
min: 0,
|
126
|
-
title: {
|
127
|
-
text: 'Time',
|
128
|
-
style: {
|
129
|
-
color: "#f6f6f6"
|
130
|
-
}
|
131
|
-
},
|
132
|
-
labels: {
|
133
|
-
style: {
|
134
|
-
color: "#a6b0cf"
|
135
|
-
}
|
136
|
-
}
|
137
|
-
},
|
138
|
-
legend: {
|
139
|
-
enabled: false
|
140
|
-
},
|
141
|
-
exporting: {
|
142
|
-
buttons: {
|
143
|
-
contextButton: {
|
144
|
-
theme: {
|
145
|
-
fill: "#eee"
|
146
|
-
}
|
42
|
+
},
|
43
|
+
labels: {
|
44
|
+
style: {
|
45
|
+
colors: ["#a6b0cf"]
|
147
46
|
}
|
148
47
|
}
|
149
|
-
}
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
},
|
155
|
-
series: [{
|
156
|
-
type: 'area',
|
157
|
-
name: 'Response Time',
|
158
|
-
data: data,
|
159
|
-
fillOpacity: 0.3,
|
160
|
-
lineWidth: 1,
|
161
|
-
states: {
|
162
|
-
hover: {
|
163
|
-
lineWidth: 1
|
164
|
-
}
|
165
|
-
}
|
166
|
-
}]
|
167
|
-
});
|
168
|
-
};
|
48
|
+
}
|
49
|
+
}
|
50
|
+
);
|
51
|
+
chart.render();
|
52
|
+
}
|
169
53
|
|
170
|
-
function
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
54
|
+
function tooltipOptions(formatter) {
|
55
|
+
return {
|
56
|
+
style: {
|
57
|
+
fontSize: '16px'
|
58
|
+
},
|
59
|
+
marker: {
|
60
|
+
show: false,
|
61
|
+
},
|
62
|
+
x: {
|
63
|
+
show: false,
|
64
|
+
format: 'dd/MM/yy HH:mm'
|
65
|
+
},
|
66
|
+
y: {
|
67
|
+
formatter: formatter,
|
176
68
|
title: {
|
177
|
-
|
178
|
-
}
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
return false;
|
192
|
-
}
|
193
|
-
return this.y + ' %';
|
194
|
-
}
|
195
|
-
},
|
196
|
-
xAxis: {
|
197
|
-
crosshair: true,
|
198
|
-
type: 'datetime',
|
199
|
-
labels: {
|
200
|
-
style: {
|
201
|
-
color: "#a6b0cf"
|
202
|
-
}
|
203
|
-
}
|
204
|
-
},
|
205
|
-
yAxis: {
|
206
|
-
min: 0,
|
207
|
-
title: {
|
208
|
-
text: '%',
|
209
|
-
style: {
|
210
|
-
color: "#f6f6f6"
|
211
|
-
}
|
212
|
-
},
|
213
|
-
labels: {
|
214
|
-
style: {
|
215
|
-
color: "#a6b0cf"
|
216
|
-
}
|
217
|
-
}
|
218
|
-
},
|
219
|
-
legend: {
|
220
|
-
enabled: false
|
221
|
-
},
|
222
|
-
exporting: {
|
223
|
-
buttons: {
|
224
|
-
contextButton: {
|
225
|
-
theme: {
|
226
|
-
fill: "#eee"
|
227
|
-
}
|
228
|
-
}
|
229
|
-
}
|
230
|
-
},
|
231
|
-
plotOptions: {
|
232
|
-
area: {
|
233
|
-
color: '#ff5b5b',
|
234
|
-
}
|
235
|
-
},
|
236
|
-
series: [{
|
237
|
-
type: 'line',
|
238
|
-
name: name,
|
239
|
-
data: data,
|
240
|
-
fillOpacity: 0.3,
|
241
|
-
lineWidth: 1,
|
242
|
-
states: {
|
243
|
-
hover: {
|
244
|
-
lineWidth: 2
|
245
|
-
}
|
246
|
-
}
|
247
|
-
}]
|
69
|
+
formatter: () => '',
|
70
|
+
}
|
71
|
+
}
|
72
|
+
};
|
73
|
+
}
|
74
|
+
|
75
|
+
function showTIRChart(element_id, data, addon, name) {
|
76
|
+
console.dir(data);
|
77
|
+
showChart(element_id, 'area', 'RPM', {
|
78
|
+
tooltip: tooltipOptions(value => (value ? value + addon : undefined)),
|
79
|
+
series: [{
|
80
|
+
name: name,
|
81
|
+
data: data
|
82
|
+
}]
|
248
83
|
});
|
249
|
-
}
|
84
|
+
}
|
250
85
|
|
86
|
+
function showRTChart(element_id, data) {
|
87
|
+
showChart(element_id, 'area', 'Time', {
|
88
|
+
tooltip: tooltipOptions(value => (value ? value + ' ms' : undefined)),
|
89
|
+
series: [{
|
90
|
+
name: 'Response Time',
|
91
|
+
data: data,
|
92
|
+
}],
|
93
|
+
});
|
94
|
+
}
|
251
95
|
|
252
|
-
function
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
text: ''
|
260
|
-
},
|
261
|
-
tooltip: {
|
262
|
-
borderWidth: 0,
|
263
|
-
backgroundColor: 'yellow',
|
264
|
-
pointFormat: '{point.y}',
|
265
|
-
//headerFormat: '',
|
266
|
-
shadow: false,
|
267
|
-
style: {
|
268
|
-
fontSize: '16px',
|
269
|
-
color: '#000',
|
270
|
-
},
|
271
|
-
formatter: function() {
|
272
|
-
if (this.y == 0) {
|
273
|
-
return false;
|
274
|
-
}
|
275
|
-
return bytes(this.y, true);
|
276
|
-
}
|
277
|
-
},
|
278
|
-
xAxis: {
|
279
|
-
crosshair: true,
|
280
|
-
type: 'datetime',
|
281
|
-
labels: {
|
282
|
-
style: {
|
283
|
-
color: "#a6b0cf"
|
284
|
-
}
|
285
|
-
}
|
286
|
-
},
|
287
|
-
yAxis: {
|
288
|
-
min: 0,
|
289
|
-
title: {
|
290
|
-
text: '',
|
291
|
-
style: {
|
292
|
-
color: "#f6f6f6"
|
293
|
-
}
|
294
|
-
},
|
295
|
-
labels: {
|
296
|
-
style: {
|
297
|
-
color: "#a6b0cf"
|
298
|
-
}
|
299
|
-
}
|
300
|
-
},
|
301
|
-
legend: {
|
302
|
-
enabled: false
|
303
|
-
},
|
304
|
-
exporting: {
|
305
|
-
buttons: {
|
306
|
-
contextButton: {
|
307
|
-
theme: {
|
308
|
-
fill: "#eee"
|
309
|
-
}
|
310
|
-
}
|
311
|
-
}
|
312
|
-
},
|
313
|
-
plotOptions: {
|
314
|
-
area: {
|
315
|
-
color: '#ff5b5b',
|
316
|
-
}
|
317
|
-
},
|
318
|
-
series: [{
|
319
|
-
type: 'line',
|
320
|
-
name: name,
|
321
|
-
data: data,
|
322
|
-
fillOpacity: 0.3,
|
323
|
-
lineWidth: 1,
|
324
|
-
states: {
|
325
|
-
hover: {
|
326
|
-
lineWidth: 2
|
327
|
-
}
|
328
|
-
}
|
329
|
-
}]
|
96
|
+
function showPercentageChart(element_id, data, name) {
|
97
|
+
showChart(element_id, 'line', '%', {
|
98
|
+
tooltip: tooltipOptions(value => (value ? value + ' %' : undefined)),
|
99
|
+
series: [{
|
100
|
+
name: name,
|
101
|
+
data: data,
|
102
|
+
}]
|
330
103
|
});
|
331
|
-
}
|
104
|
+
}
|
105
|
+
|
106
|
+
function showUsageChart(element_id, data, name, pow) {
|
107
|
+
const units = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB'][pow];
|
108
|
+
const bytes = Math.pow(1024, pow);
|
332
109
|
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
return value;
|
110
|
+
showChart(element_id, 'line', name, {
|
111
|
+
tooltip: tooltipOptions(value => (value ? `${value} ${units}` : undefined)),
|
112
|
+
series: [{
|
113
|
+
name: name,
|
114
|
+
data: data.map(([timestamp, value]) => [timestamp, typeof value === 'number' ? (value / bytes).toFixed(2) : null]),
|
115
|
+
}]
|
116
|
+
});
|
341
117
|
}
|
342
118
|
|
343
|
-
const recent = document.getElementById("recent")
|
344
|
-
const autoupdate = document.getElementById("autoupdate")
|
119
|
+
const recent = document.getElementById("recent");
|
120
|
+
const autoupdate = document.getElementById("autoupdate");
|
345
121
|
|
346
|
-
if(autoupdate) {
|
122
|
+
if (autoupdate) {
|
347
123
|
// set autoupdate checked from localStorage is missing
|
348
124
|
if (localStorage.getItem("autoupdate") === null) {
|
349
125
|
localStorage.setItem("autoupdate", "true");
|
@@ -354,12 +130,12 @@ if(autoupdate) {
|
|
354
130
|
});
|
355
131
|
}
|
356
132
|
|
357
|
-
if(recent) {
|
358
|
-
const tbody = recent.querySelector("tbody")
|
133
|
+
if (recent) {
|
134
|
+
const tbody = recent.querySelector("tbody");
|
359
135
|
|
360
136
|
setInterval(() => {
|
361
|
-
tr = tbody.children[0];
|
362
|
-
from_timei = tr.getAttribute("from_timei") || ''
|
137
|
+
const tr = tbody.children[0];
|
138
|
+
const from_timei = tr.getAttribute("from_timei") || '';
|
363
139
|
|
364
140
|
if (!autoupdate.checked) {
|
365
141
|
return;
|
@@ -373,6 +149,6 @@ if(recent) {
|
|
373
149
|
.then(res => res.text())
|
374
150
|
.then(html => {
|
375
151
|
tbody.innerHTML = html + tbody.innerHTML;
|
376
|
-
|
152
|
+
});
|
377
153
|
}, 3000);
|
378
154
|
}
|
@@ -6,9 +6,6 @@
|
|
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>
|
12
9
|
<%= render '/rails_performance/stylesheets/stylesheets' %>
|
13
10
|
<link rel="shortcut icon" href="/favicon.ico">
|
14
11
|
</head>
|
@@ -38,13 +38,13 @@
|
|
38
38
|
<script>
|
39
39
|
<% @resources_report.data.keys.each do |server_key| %>
|
40
40
|
var data1 = <%= raw @resources_report.cpu[server_key].to_json %>;
|
41
|
-
showPercentageChart('cpu_report_<%= server_key.parameterize %>', data1, '
|
41
|
+
showPercentageChart('cpu_report_<%= server_key.parameterize %>', data1, 'CPU');
|
42
42
|
|
43
43
|
var data2 = <%= raw @resources_report.memory[server_key].to_json %>;
|
44
|
-
showUsageChart('memory_report_<%= server_key.parameterize %>', data2, '
|
44
|
+
showUsageChart('memory_report_<%= server_key.parameterize %>', data2, 'Usage', 2);
|
45
45
|
|
46
46
|
var data3 = <%= raw @resources_report.disk[server_key].to_json %>;
|
47
|
-
showUsageChart('disk_report_<%= server_key.parameterize %>', data3, '
|
47
|
+
showUsageChart('disk_report_<%= server_key.parameterize %>', data3, 'Available', 3);
|
48
48
|
<% end %>
|
49
49
|
</script>
|
50
50
|
<% end %>
|
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.
|
4
|
+
version: 1.4.1.alpha1
|
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-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -320,6 +320,7 @@ files:
|
|
320
320
|
- app/helpers/rails_performance/rails_performance_helper.rb
|
321
321
|
- app/views/rails_performance/_panel.html.erb
|
322
322
|
- app/views/rails_performance/javascripts/_javascripts.html.erb
|
323
|
+
- app/views/rails_performance/javascripts/apexcharts.min.js
|
323
324
|
- app/views/rails_performance/javascripts/app.js
|
324
325
|
- app/views/rails_performance/javascripts/jquery-3.4.1.min.js
|
325
326
|
- app/views/rails_performance/javascripts/navbar.js
|