-
Notifications
You must be signed in to change notification settings - Fork 229
/
debug.ego
91 lines (84 loc) · 2.33 KB
/
debug.ego
1
2
3
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
40
41
42
43
44
45
46
47
48
49
50
51
52
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
<%
package webui
import (
"net/http"
"runtime"
"github.com/contribsys/faktory/client"
)
func ego_debug(w io.Writer, req *http.Request) {
stats := ctx(req).Store().Stats(req.Context())
var m runtime.MemStats
runtime.ReadMemStats(&m)
rdata, rtt := redis_info(req)
%>
<% ego_layout(w, req, func() { %>
<h3><%= t(req, "Debugging") %></h3>
<div class="table-responsive">
<table class="error table table-bordered table-striped table-light">
<tbody>
<tr>
<th><%= t(req, "Locale") %></th>
<td>
<select name="locales" id="faktory_locale">
<% sortedLocaleNames(req, func(locale string, current bool) { %>
<option name="<%= locale %>" <% if current { %> selected <% } %> > <%= locale %> </option>
<% }) %>
</select>
<span style="font-size: small">
Want to help us improve the translations?
<a href="https://github.com/contribsys/faktory/tree/master/webui/static/locales">Submit a PR</a>.
</span>
</td>
</tr>
<tr>
<th><%= t(req, "Version") %></th>
<td><%= client.Name %> <%= client.Version %></td>
</tr>
<tr>
<th><%= t(req, "Data Location") %></th>
<td><%= stats["name"] %></td>
</tr>
<tr>
<th><%= t(req, "Runtime") %></th>
<td>Goroutines: <%= runtime.NumGoroutine() %>, CPUs: <%= runtime.NumCPU() %></td>
</tr>
<tr>
<th><%= t(req, "Memory") %></th>
<td>
Alloc (KB): <%= m.Alloc / 1024 %><br/>
Live Objects: <%= m.Mallocs - m.Frees %>
<% if amt := client.RssKb(); amt != 0 { %>
<br/>RSS: <%= displayRss(amt) %>
<% } %>
</td>
</tr>
<tr>
<th><%= t(req, "GC") %></th>
<td>
PauseTotal (µs): <%= m.PauseTotalNs / 1000 %><br/>
NumGC: <%= m.NumGC %>
</td>
</tr>
<tr>
<th>
<%= t(req, "Redis RTT") %>
<a href="https://github.com/contribsys/faktory/wiki/Storage#rtt"><span class="info-circle" title="Click to learn more about RTT">?</span></a>
</th>
<td class="fw-bold text-<%= category_for_rtt(rtt) %>">
<%= rtt %> µs
</td>
</tr>
</tbody>
</table>
</div>
<h3><%= t(req, "Redis Info") %></h3>
<pre>
<%= rdata %>
</pre>
<h3><%= t(req, "Disk Usage") %></h3>
<pre>
<code>> df -h</code>
<%= df_h() %>
</pre>
<% }) %>
<% } %>