rails_performance 1.2.0.alpha1 → 1.2.0.alpha3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/rails_performance/application_helper.rb +2 -4
- data/app/views/rails_performance/javascripts/_javascripts.html.erb +0 -1
- data/app/views/rails_performance/javascripts/app.js +6 -8
- data/lib/rails_performance/reports/base_report.rb +10 -1
- data/lib/rails_performance/reports/response_time_report.rb +3 -2
- data/lib/rails_performance/reports/throughput_report.rb +6 -3
- data/lib/rails_performance/version.rb +1 -1
- data/lib/rails_performance.rb +0 -1
- metadata +1 -16
- data/app/views/rails_performance/javascripts/local-time.es2017-umd.js +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4cc5606eeacc1d036f322a9eda07cea2d2151c23ad96052f2e7a695ea288e5a
|
4
|
+
data.tar.gz: 51fe7e76287eb361e0d2135039f4f95c03f559ca575bae8883b1a94c107762e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc80d1c5713b87b6338778086bc6b4180f36bfd9d38b96753bf92e733f985fa9101ea53c8a426a0cf41c1916dc83266d7f53868b2ceaf6aa4c7c7be11f3ab158
|
7
|
+
data.tar.gz: 8a54a10c63673d143fe07cfddf03db2000d6f957b3d913edfebf5f0c06f598c5808732dedbb0e3b37e4b280cd00f21b5ba21dbe36248103c5f930015870e81f9
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module RailsPerformance
|
2
2
|
module ApplicationHelper
|
3
|
-
include LocalTimeHelper
|
4
3
|
|
5
4
|
def round_it(value, limit = 1)
|
6
5
|
return nil unless value
|
@@ -107,9 +106,8 @@ module RailsPerformance
|
|
107
106
|
end
|
108
107
|
|
109
108
|
def format_datetime(e)
|
110
|
-
|
111
|
-
|
112
|
-
local_time(e, "%Y-%m-%d %H:%M:%S")
|
109
|
+
dt = RailsPerformance::Reports::BaseReport::time_in_app_time_zone(e)
|
110
|
+
I18n.l(dt, format: "%Y-%m-%d %H:%M:%S")
|
113
111
|
end
|
114
112
|
|
115
113
|
def active?(section)
|
@@ -1,7 +1,6 @@
|
|
1
1
|
<%= insert_js_file 'jquery-3.4.1.min.js' %>
|
2
2
|
<%= insert_js_file 'rails.js' %>
|
3
3
|
<%= insert_js_file 'stupidtable.min.js' %>
|
4
|
-
<%= insert_js_file 'local-time.es2017-umd.js' %>
|
5
4
|
|
6
5
|
<%= javascript_include_tag 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/js/all.min.js' %>
|
7
6
|
<%= javascript_include_tag 'https://code.highcharts.com/highcharts.js' %>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
function showTIRChart(div, data, addon, name) {
|
2
2
|
Highcharts.chart(div, {
|
3
|
-
time: {
|
4
|
-
|
5
|
-
},
|
3
|
+
// time: {
|
4
|
+
// timezone: 'Europe/Kiev'
|
5
|
+
// },
|
6
6
|
chart: {
|
7
7
|
type: 'area',
|
8
8
|
zoomType: 'x',
|
@@ -84,9 +84,9 @@ function showTIRChart(div, data, addon, name) {
|
|
84
84
|
|
85
85
|
function showRTChart(div, data) {
|
86
86
|
Highcharts.chart(div, {
|
87
|
-
time: {
|
88
|
-
|
89
|
-
},
|
87
|
+
// time: {
|
88
|
+
// timezone: 'Europe/Kiev'
|
89
|
+
// },
|
90
90
|
chart: {
|
91
91
|
type: 'area',
|
92
92
|
zoomType: 'x',
|
@@ -203,5 +203,3 @@ if(recent) {
|
|
203
203
|
})
|
204
204
|
}, 3000);
|
205
205
|
}
|
206
|
-
|
207
|
-
LocalTime.start()
|
@@ -20,6 +20,15 @@ module RailsPerformance
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def set_defaults; end
|
23
|
+
|
24
|
+
def self.time_in_app_time_zone(time)
|
25
|
+
app_time_zone = ::Rails.application.config.time_zone
|
26
|
+
if app_time_zone.present?
|
27
|
+
time.in_time_zone(app_time_zone)
|
28
|
+
else
|
29
|
+
time
|
30
|
+
end
|
31
|
+
end
|
23
32
|
end
|
24
33
|
end
|
25
|
-
end
|
34
|
+
end
|
@@ -7,10 +7,10 @@ module RailsPerformance
|
|
7
7
|
|
8
8
|
def data
|
9
9
|
all = {}
|
10
|
-
stop = Time.at(60 * (Time.now.to_i / 60))
|
10
|
+
stop = RailsPerformance::Reports::BaseReport::time_in_app_time_zone(Time.at(60 * (Time.now.to_i / 60)))
|
11
|
+
offset = RailsPerformance::Reports::BaseReport::time_in_app_time_zone(Time.now).utc_offset
|
11
12
|
current = stop - RailsPerformance.duration
|
12
13
|
@data = []
|
13
|
-
offset = Time.now.utc_offset
|
14
14
|
|
15
15
|
# puts "current: #{current}"
|
16
16
|
# puts "stop: #{stop}"
|
@@ -25,6 +25,7 @@ module RailsPerformance
|
|
25
25
|
# add blank columns
|
26
26
|
while current <= stop
|
27
27
|
views = all[current.strftime(RailsPerformance::FORMAT)] || 0
|
28
|
+
# time = RailsPerformance::Reports::BaseReport::time_in_app_time_zone(current)
|
28
29
|
@data << [(current.to_i + offset) * 1000, views.round(2)]
|
29
30
|
current += 1.minute
|
30
31
|
end
|
@@ -6,12 +6,15 @@ module RailsPerformance
|
|
6
6
|
@group ||= :datetime
|
7
7
|
end
|
8
8
|
|
9
|
+
# RailsPerformance::Reports::ThroughputReport.new(db).data
|
10
|
+
# Time.at(RailsPerformance::Reports::ThroughputReport.new(db).data.last[0] / 1000)
|
11
|
+
|
9
12
|
def data
|
10
13
|
all = {}
|
11
|
-
stop = Time.at(60 * (Time.now.to_i / 60))
|
14
|
+
stop = RailsPerformance::Reports::BaseReport::time_in_app_time_zone(Time.at(60 * (Time.now.to_i / 60)))
|
15
|
+
offset = RailsPerformance::Reports::BaseReport::time_in_app_time_zone(Time.now).utc_offset
|
12
16
|
current = stop - RailsPerformance.duration
|
13
17
|
@data = []
|
14
|
-
offset = Time.now.utc_offset
|
15
18
|
|
16
19
|
# puts "current: #{current}"
|
17
20
|
# puts "stop: #{stop}"
|
@@ -24,7 +27,7 @@ module RailsPerformance
|
|
24
27
|
# add blank columns
|
25
28
|
while current <= stop
|
26
29
|
views = all[current.strftime(RailsPerformance::FORMAT)] || 0
|
27
|
-
@data << [(current.to_i + offset) * 1000, views.
|
30
|
+
@data << [(current.to_i + offset) * 1000, views.round(2)]
|
28
31
|
current += 1.minute
|
29
32
|
end
|
30
33
|
|
data/lib/rails_performance.rb
CHANGED
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.2.0.
|
4
|
+
version: 1.2.0.alpha3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Kasyanchuk
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: local_time
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: sqlite3
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -248,7 +234,6 @@ files:
|
|
248
234
|
- app/views/rails_performance/javascripts/_javascripts.html.erb
|
249
235
|
- app/views/rails_performance/javascripts/app.js
|
250
236
|
- app/views/rails_performance/javascripts/jquery-3.4.1.min.js
|
251
|
-
- app/views/rails_performance/javascripts/local-time.es2017-umd.js
|
252
237
|
- app/views/rails_performance/javascripts/navbar.js
|
253
238
|
- app/views/rails_performance/javascripts/panel.js
|
254
239
|
- app/views/rails_performance/javascripts/rails.js
|
@@ -1 +0,0 @@
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).LocalTime=e()}(this,(function(){"use strict";var t;t={config:{},run:function(){return this.getController().processElements()},process:function(...t){var e,r,a;for(r=0,a=t.length;r<a;r++)e=t[r],this.getController().processElement(e);return t.length},getController:function(){return null!=this.controller?this.controller:this.controller=new t.Controller}};var e,r,a,n,s,i,o,u,l,c,d,m,h,f,g,y,p,v,b,S,M,T,D,E,w,A,N,O,$,C=t;return C.config.i18n={en:{date:{dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbrDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbrMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],yesterday:"yesterday",today:"today",tomorrow:"tomorrow",on:"on {date}",formats:{default:"%b %e, %Y",thisYear:"%b %e"}},time:{am:"am",pm:"pm",singular:"a {time}",singularAn:"an {time}",elapsed:"{time} ago",second:"second",seconds:"seconds",minute:"minute",minutes:"minutes",hour:"hour",hours:"hours",formats:{default:"%l:%M%P"}},datetime:{at:"{date} at {time}",formats:{default:"%B %e, %Y at %l:%M%P %Z"}}}},C.config.locale="en",C.config.defaultLocale="en",C.config.timerInterval=6e4,a=!isNaN(Date.parse("2011-01-01T12:00:00-05:00")),C.parseDate=function(t){return t=t.toString(),a||(t=r(t)),new Date(Date.parse(t))},e=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(Z|[-+]?[\d:]+)$/,r=function(t){var r,a,n,s,i,o,u,l,c,d;if(s=t.match(e))return[r,c,o,a,n,i,l,d]=s,"Z"!==d&&(u=d.replace(":","")),`${c}/${o}/${a} ${n}:${i}:${l} GMT${[u]}`},C.elementMatchesSelector=(n=document.documentElement,s=null!=(i=null!=(o=null!=(u=null!=(l=n.matches)?l:n.matchesSelector)?u:n.webkitMatchesSelector)?o:n.mozMatchesSelector)?i:n.msMatchesSelector,function(t,e){if((null!=t?t.nodeType:void 0)===Node.ELEMENT_NODE)return s.call(t,e)}),({config:c}=C),({i18n:m}=c),C.getI18nValue=function(t="",{locale:e}={locale:c.locale}){var r;return null!=(r=d(m[e],t))?r:e!==c.defaultLocale?C.getI18nValue(t,{locale:c.defaultLocale}):void 0},C.translate=function(t,e={},r){var a,n,s;for(a in s=C.getI18nValue(t,r),e)n=e[a],s=s.replace(`{${a}}`,n);return s},d=function(t,e){var r,a,n,s,i;for(i=t,r=0,n=(s=e.split(".")).length;r<n;r++){if(null==i[a=s[r]])return null;i=i[a]}return i},({getI18nValue:h,translate:p}=C),C.strftime=y=function(t,e){var r,a,n,s,i,o,u;return a=t.getDay(),r=t.getDate(),i=t.getMonth(),u=t.getFullYear(),n=t.getHours(),s=t.getMinutes(),o=t.getSeconds(),e.replace(/%(-?)([%aAbBcdeHIlmMpPSwyYZ])/g,(function(e,l,c){switch(c){case"%":return"%";case"a":return h("date.abbrDayNames")[a];case"A":return h("date.dayNames")[a];case"b":return h("date.abbrMonthNames")[i];case"B":return h("date.monthNames")[i];case"c":return t.toString();case"d":return f(r,l);case"e":return r;case"H":return f(n,l);case"I":return f(y(t,"%l"),l);case"l":return 0===n||12===n?12:(n+12)%12;case"m":return f(i+1,l);case"M":return f(s,l);case"p":return p("time."+(n>11?"pm":"am")).toUpperCase();case"P":return p("time."+(n>11?"pm":"am"));case"S":return f(o,l);case"w":return a;case"y":return f(u%100,l);case"Y":return u;case"Z":return g(t)}}))},f=function(t,e){return"-"===e?t:`0${t}`.slice(-2)},g=function(t){var e,r,a,n,s;return(e=null!=(r=(s=t.toString()).match(/\(([\w\s]+)\)$/))?r[1]:void 0)?/\s/.test(e)?e.match(/\b(\w)/g).join(""):e:(e=null!=(a=s.match(/(\w{3,4})\s\d{4}$/))?a[1]:void 0)||(e=null!=(n=s.match(/(UTC[\+\-]\d+)/))?n[1]:void 0)?e:""},C.CalendarDate=class{static fromDate(t){return new this(t.getFullYear(),t.getMonth()+1,t.getDate())}static today(){return this.fromDate(new Date)}constructor(t,e,r){this.date=new Date(Date.UTC(t,e-1)),this.date.setUTCDate(r),this.year=this.date.getUTCFullYear(),this.month=this.date.getUTCMonth()+1,this.day=this.date.getUTCDate(),this.value=this.date.getTime()}equals(t){return(null!=t?t.value:void 0)===this.value}is(t){return this.equals(t)}isToday(){return this.is(this.constructor.today())}occursOnSameYearAs(t){return this.year===(null!=t?t.year:void 0)}occursThisYear(){return this.occursOnSameYearAs(this.constructor.today())}daysSince(t){if(t)return(this.date-t.date)/864e5}daysPassed(){return this.constructor.today().daysSince(this)}},({strftime:b,translate:S,getI18nValue:v}=C),C.RelativeTime=class{constructor(t){this.date=t,this.calendarDate=C.CalendarDate.fromDate(this.date)}toString(){var t,e;return(e=this.toTimeElapsedString())?S("time.elapsed",{time:e}):(t=this.toWeekdayString())?(e=this.toTimeString(),S("datetime.at",{date:t,time:e})):S("date.on",{date:this.toDateString()})}toTimeOrDateString(){return this.calendarDate.isToday()?this.toTimeString():this.toDateString()}toTimeElapsedString(){var t,e,r,a,n;return r=(new Date).getTime()-this.date.getTime(),a=Math.round(r/1e3),e=Math.round(a/60),t=Math.round(e/60),r<0?null:a<10?(n=S("time.second"),S("time.singular",{time:n})):a<45?`${a} ${S("time.seconds")}`:a<90?(n=S("time.minute"),S("time.singular",{time:n})):e<45?`${e} ${S("time.minutes")}`:e<90?(n=S("time.hour"),S("time.singularAn",{time:n})):t<24?`${t} ${S("time.hours")}`:""}toWeekdayString(){switch(this.calendarDate.daysPassed()){case 0:return S("date.today");case 1:return S("date.yesterday");case-1:return S("date.tomorrow");case 2:case 3:case 4:case 5:case 6:return b(this.date,"%A");default:return""}}toDateString(){var t;return t=this.calendarDate.occursThisYear()?v("date.formats.thisYear"):v("date.formats.default"),b(this.date,t)}toTimeString(){return b(this.date,v("time.formats.default"))}},({elementMatchesSelector:M}=C),C.PageObserver=class{constructor(t,e){this.processMutations=this.processMutations.bind(this),this.processInsertion=this.processInsertion.bind(this),this.selector=t,this.callback=e}start(){if(!this.started)return this.observeWithMutationObserver()||this.observeWithMutationEvent(),this.started=!0}observeWithMutationObserver(){if("undefined"!=typeof MutationObserver&&null!==MutationObserver)return new MutationObserver(this.processMutations).observe(document.documentElement,{childList:!0,subtree:!0}),!0}observeWithMutationEvent(){return addEventListener("DOMNodeInserted",this.processInsertion,!1),!0}findSignificantElements(t){var e;return e=[],(null!=t?t.nodeType:void 0)===Node.ELEMENT_NODE&&(M(t,this.selector)&&e.push(t),e.push(...t.querySelectorAll(this.selector))),e}processMutations(t){var e,r,a,n,s,i,o,u;for(e=[],r=0,n=t.length;r<n;r++)if("childList"===(i=t[r]).type)for(a=0,s=(u=i.addedNodes).length;a<s;a++)o=u[a],e.push(...this.findSignificantElements(o));return this.notify(e)}processInsertion(t){var e;return e=this.findSignificantElements(t.target),this.notify(e)}notify(t){if(null!=t?t.length:void 0)return"function"==typeof this.callback?this.callback(t):void 0}},({parseDate:E,strftime:w,getI18nValue:D,config:T}=C),C.Controller=function(){var t,e,r;return t="time[data-local]:not([data-localized])",e=function(t){return t.setAttribute("data-localized","")},r=function(t){return new C.RelativeTime(t)},class{constructor(){this.processElements=this.processElements.bind(this),this.pageObserver=new C.PageObserver(t,this.processElements)}start(){if(!this.started)return this.processElements(),this.startTimer(),this.pageObserver.start(),this.started=!0}startTimer(){var t;if(t=T.timerInterval)return null!=this.timer?this.timer:this.timer=setInterval(this.processElements,t)}processElements(e=document.querySelectorAll(t)){var r,a,n;for(a=0,n=e.length;a<n;a++)r=e[a],this.processElement(r);return e.length}processElement(t){var a,n,s,i,o,u;if(n=t.getAttribute("datetime"),s=t.getAttribute("data-format"),i=t.getAttribute("data-local"),o=E(n),!isNaN(o))return t.hasAttribute("title")||(u=w(o,D("datetime.formats.default")),t.setAttribute("title",u)),t.textContent=a=function(){switch(i){case"time":return e(t),w(o,s);case"date":return e(t),r(o).toDateString();case"time-ago":return r(o).toString();case"time-or-date":return r(o).toTimeOrDateString();case"weekday":return r(o).toWeekdayString();case"weekday-or-date":return r(o).toWeekdayString()||r(o).toDateString()}}(),t.hasAttribute("aria-label")?void 0:t.setAttribute("aria-label",a)}}}.call(window),$=!1,A=function(){return document.attachEvent?"complete"===document.readyState:"loading"!==document.readyState},N=function(t){var e;return null!=(e="function"==typeof requestAnimationFrame?requestAnimationFrame(t):void 0)?e:setTimeout(t,17)},O=function(){return C.getController().start()},C.start=function(){if(!$)return $=!0,"undefined"!=typeof MutationObserver&&null!==MutationObserver||A()?O():N(O)},window.LocalTime===C&&C.start(),C}));
|