Class: GroongaQueryLog::Command::Analyzer::HTMLReporter
- Inherits:
-
Reporter
- Object
- Reporter
- GroongaQueryLog::Command::Analyzer::HTMLReporter
show all
- Includes:
- ERB::Util
- Defined in:
- lib/groonga-query-log/command/analyzer/reporter/html.rb
Instance Attribute Summary
Attributes inherited from Reporter
#output, #slow_operation_threshold, #slow_response_threshold
Instance Method Summary
collapse
Methods inherited from Reporter
#each, #initialize, #report
Instance Method Details
#finish ⇒ Object
31
32
33
|
# File 'lib/groonga-query-log/command/analyzer/reporter/html.rb', line 31
def finish
write()
end
|
#report_statistic(statistic) ⇒ Object
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
# File 'lib/groonga-query-log/command/analyzer/reporter/html.rb', line 53
def report_statistic(statistic)
command = statistic.command
_ = command statistic_html = erb(<<-EOH, __LINE__ + 1, binding)
<div class="statistic-heading">
<h3>Command</h3>
<div class="metrics">
[<%= format_time(statistic.start_time) %>
-
<%= format_time(statistic.last_time) %>
(<%= format_elapsed(statistic.elapsed_in_seconds,
:slow? => statistic.slow?) %>)]
(<%= span({:class => "return-code"}, h(statistic.return_code)) %>)
</div>
<% if @report_command_line %>
<%= div({:class => "raw-command"}, h(statistic.raw_command)) %>
<% end %>
</div>
<div class="statistic-parameters">
<h3>Parameters</h3>
<dl>
<dt>name</dt>
<dd><%= h(command.name) %></dd>
<% command.arguments.each do |key, value| %>
<dt><%= h(key) %></dt>
<dd><%= h(value) %></dd>
<% end %>
</dl>
</div>
<div class="statistic-operations">
<h3>Operations</h3>
<table>
<thead>
<tr>
<th>Nth</th>
<th>Elapsed(sec)</th>
<th>Name</th>
<th>N records</th>
<th>Context</th>
</tr>
</thead>
<tbody>
<% statistic.each_operation.with_index do |operation, i| %>
<tr>
<td class="n"><%= h(i + 1) %></td>
<td class="elapsed">
<%= format_elapsed(operation[:relative_elapsed_in_seconds],
:slow? => operation[:slow?]) %>
</td>
<td class="name"><%= h(operation[:name]) %></td>
<td class="n-records"><%= h(operation[:n_records]) %></td>
<td class="context"><%= h(operation[:context]) %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
EOH
write(statistic_html)
end
|
#report_statistics ⇒ Object
47
48
49
50
51
|
# File 'lib/groonga-query-log/command/analyzer/reporter/html.rb', line 47
def report_statistics
write()
super
write()
end
|
#report_summary ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/groonga-query-log/command/analyzer/reporter/html.rb', line 35
def report_summary
summary_html = erb(<<-EOH, __LINE__ + 1, binding)
<h2>Summary</h2>
<div class="summary">
<%= analyze_parameters %>
<%= metrics %>
<%= slow_operations %>
</div>
EOH
write(summary_html)
end
|
#start ⇒ Object
27
28
29
|
# File 'lib/groonga-query-log/command/analyzer/reporter/html.rb', line 27
def start
write()
end
|