Class: RailsObservatory::RequestsController
Instance Method Summary
collapse
#duration, #set_duration, #set_time_range
Instance Method Details
#index ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'app/controllers/rails_observatory/requests_controller.rb', line 4
def index
@time_range = (duration.seconds.ago..)
if params[:controller_action].blank?
@count_by_controller = TimeSeries.where(name: 'request.count', action: '*')
.slice(@time_range)
.downsample(1, using: :sum)
.select { _1.value > 0 }
.sort_by(&:value)
.reverse
@latency_by_controller = TimeSeries.where(name: 'request.latency', action: '*')
.slice(@time_range)
.downsample(1, using: :avg)
.index_by { _1.labels[:action] }
end
RequestTrace.ensure_index
@events = RequestTrace.all
end
|
#show ⇒ Object
25
26
27
28
29
30
|
# File 'app/controllers/rails_observatory/requests_controller.rb', line 25
def show
@request = RequestTrace.find(params[:id])
@middleware_events = @request.events.only('process_middleware.action_dispatch')
@events = @request.events
@icicle_chart_series = @events.to_series
end
|