4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'app/controllers/concerns/response_range_concern.rb', line 4
def setup_duration_range(type = :route)
ransack_params = params[:q] || {}
thresholds = RailsPulse.configuration.public_send("#{type}_thresholds")
duration_param = ransack_params[:avg_duration] || ransack_params[:duration] || ransack_params[:duration_gteq]
if duration_param.present?
selected_range = duration_param
start_duration =
case duration_param.to_sym
when :slow then thresholds[:slow]
when :very_slow then thresholds[:very_slow]
when :critical then thresholds[:critical]
else 0
end
elsif (global_threshold = session_global_filters["performance_threshold"]).present?
selected_range = global_threshold.to_sym
start_duration =
case global_threshold.to_sym
when :slow then thresholds[:slow]
when :very_slow then thresholds[:very_slow]
when :critical then thresholds[:critical]
else 0
end
else
start_duration = 0
selected_range = :all
end
[ start_duration, selected_range ]
end
|