Class: Profiler::Collectors::RequestCollector
Instance Attribute Summary
#profile
Instance Method Summary
collapse
descendants, #has_data?, inherited, #initialize, #name, #panel_content, #render_html, #render_mode, #subscribe
Instance Method Details
#collect ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/profiler/collectors/request_collector.rb', line 27
def collect
data = {
path: @profile.path,
method: @profile.method,
status: @profile.status,
duration: @profile.duration,
memory: @profile.memory,
params: @profile.params,
headers: @profile.,
response_headers: @profile.,
request_body: @profile.request_body,
request_body_encoding: @profile.request_body_encoding,
response_body: @profile.response_body,
response_body_encoding: @profile.response_body_encoding,
started_at: @profile.started_at&.iso8601,
finished_at: @profile.finished_at&.iso8601
}
data.merge!(collect_route_info)
store_data(data)
end
|
#icon ⇒ Object
8
9
10
|
# File 'lib/profiler/collectors/request_collector.rb', line 8
def icon
"🌐"
end
|
#priority ⇒ Object
12
13
14
|
# File 'lib/profiler/collectors/request_collector.rb', line 12
def priority
10
end
|
#tab_config ⇒ Object
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/profiler/collectors/request_collector.rb', line 16
def tab_config
{
key: "request",
label: "Request",
icon: icon,
priority: priority,
enabled: true,
default_active: false
}
end
|
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/profiler/collectors/request_collector.rb', line 49
def toolbar_summary
status_color = case @profile.status
when 200..299 then "green"
when 300..399 then "blue"
when 400..499 then "orange"
when 500..599 then "red"
else "gray"
end
{
text: "#{@profile.method} #{@profile.status}",
color: status_color,
duration: @profile.duration,
memory: format_memory(@profile.memory)
}
end
|