Class: RailsPerformance::ThroughputReport
Instance Attribute Summary
Attributes inherited from BaseReport
#db, #group, #sort
Instance Method Summary
collapse
Methods inherited from BaseReport
#collect, #initialize
Instance Method Details
#data ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/rails_performance/throughput_report.rb', line 8
def data
all = {}
stop = Time.at(60 * (Time.now.to_i / 60))
current = stop - RailsPerformance.duration
@data = []
offset = Time.current.utc_offset
db.group_by(group).values.each do |(k, v)|
all[k] = v.count
end
while current <= stop
views = all[current.strftime(MetricsListener::FORMAT)] || 0
@data << [(current.to_i + offset) * 1000, views.to_i]
current += 1.minute
end
@data.sort!
end
|
#set_defaults ⇒ Object
4
5
6
|
# File 'lib/rails_performance/throughput_report.rb', line 4
def set_defaults
@group ||= :datetime
end
|