Added resource utilisation data to the Debug Page.
This commit is contained in:
parent
d8682aca94
commit
9e8f455bbb
|
@ -3,6 +3,7 @@ package common
|
|||
import (
|
||||
"html/template"
|
||||
"net/http"
|
||||
"runtime"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
@ -394,8 +395,13 @@ type PanelDebugPage struct {
|
|||
GoVersion string
|
||||
DBVersion string
|
||||
Uptime string
|
||||
|
||||
OpenConns int
|
||||
DBAdapter string
|
||||
|
||||
Goroutines int
|
||||
CPUs int
|
||||
MemStats runtime.MemStats
|
||||
}
|
||||
|
||||
type PageSimple struct {
|
||||
|
|
|
@ -793,11 +793,16 @@
|
|||
"panel_backups_head":"Backups",
|
||||
"panel_backups_download":"Download",
|
||||
"panel_backups_no_backups":"There aren't any backups available at this time.",
|
||||
|
||||
"panel_debug_head":"Debug",
|
||||
"panel_debug_go_version_label":"Go Version",
|
||||
"panel_debug_database_version_label":"DB Version",
|
||||
"panel_debug_uptime_label":"Uptime",
|
||||
|
||||
"panel_debug_open_database_connections_label":"Open DB Conns",
|
||||
"panel_debug_adapter_label":"Adapter"
|
||||
"panel_debug_adapter_label":"Adapter",
|
||||
|
||||
"panel_debug_goroutine_count_label":"Goroutines",
|
||||
"panel_debug_cpu_count_label":"CPUs"
|
||||
}
|
||||
}
|
|
@ -36,7 +36,11 @@ func Debug(w http.ResponseWriter, r *http.Request, user common.User) common.Rout
|
|||
openConnCount := dbStats.OpenConnections
|
||||
// Disk I/O?
|
||||
// TODO: Fetch the adapter from Builder rather than getting it from a global?
|
||||
goroutines := runtime.NumGoroutine()
|
||||
cpus := runtime.NumCPU()
|
||||
var memStats runtime.MemStats
|
||||
runtime.ReadMemStats(&memStats)
|
||||
|
||||
pi := common.PanelDebugPage{basePage, goVersion, dbVersion, uptime, openConnCount, qgen.Builder.GetAdapter().GetName()}
|
||||
pi := common.PanelDebugPage{basePage, goVersion, dbVersion, uptime, openConnCount, qgen.Builder.GetAdapter().GetName(), goroutines, cpus, memStats}
|
||||
return panelRenderTemplate("panel_debug", w, r, user, &pi)
|
||||
}
|
||||
|
|
|
@ -17,11 +17,36 @@
|
|||
|
||||
<div class="grid_item grid_stat grid_stat_head"><span>{{lang "panel_debug_open_database_connections_label"}}</span></div>
|
||||
<div class="grid_item grid_stat grid_stat_head"><span>{{lang "panel_debug_adapter_label"}}</span></div>
|
||||
{{/** TODO: Use this for active database connections when Go 1.11 lands **/}}
|
||||
<div class="grid_item grid_stat grid_stat_head"><span>???</span></div>
|
||||
|
||||
<div class="grid_item grid_stat"><span>{{.OpenConns}}</span></div>
|
||||
<div class="grid_item grid_stat"><span>{{.DBAdapter}}</span></div>
|
||||
<div class="grid_item grid_stat"><span>?</span></div>
|
||||
|
||||
<div class="grid_item grid_stat grid_stat_head"><span>{{lang "panel_debug_goroutine_count_label"}}</span></div>
|
||||
<div class="grid_item grid_stat grid_stat_head"><span>{{lang "panel_debug_cpu_count_label"}}</span></div>
|
||||
<div class="grid_item grid_stat grid_stat_head"><span>HeapAlloc</span></div>
|
||||
|
||||
<div class="grid_item grid_stat"><span>{{.Goroutines}}</span></div>
|
||||
<div class="grid_item grid_stat"><span>{{.CPUs}}</span></div>
|
||||
<div class="grid_item grid_stat"><span>{{.MemStats.HeapAlloc}}</span></div>
|
||||
|
||||
<div class="grid_item grid_stat grid_stat_head"><span>HeapSys</span></div>
|
||||
<div class="grid_item grid_stat grid_stat_head"><span>HeapIdle</span></div>
|
||||
<div class="grid_item grid_stat grid_stat_head"><span>HeapObjects</span></div>
|
||||
|
||||
<div class="grid_item grid_stat"><span>{{.MemStats.HeapSys}}</span></div>
|
||||
<div class="grid_item grid_stat"><span>{{.MemStats.HeapIdle}}</span></div>
|
||||
<div class="grid_item grid_stat"><span>{{.MemStats.HeapObjects}}</span></div>
|
||||
|
||||
<div class="grid_item grid_stat grid_stat_head"><span>???</span></div>
|
||||
<div class="grid_item grid_stat grid_stat_head"><span>???</span></div>
|
||||
<div class="grid_item grid_stat grid_stat_head"><span>StackInuse</span></div>
|
||||
|
||||
<div class="grid_item grid_stat"><span>?</span></div>
|
||||
<div class="grid_item grid_stat"><span>?</span></div>
|
||||
<div class="grid_item grid_stat"><span>{{.MemStats.StackInuse}}</span></div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue