mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-08-28 08:34:15 +00:00
fix: goRuntime perf fields match frontend expectations (goroutines, heapAllocMB, etc.)
Frontend reads goroutines/pauseTotalMs/lastPauseMs/heapAllocMB/heapSysMB/ heapInuseMB/heapIdleMB/numCPU but Go was returning heapMB/sysMB/numGoroutine/ gcPauseMs. All showed as undefined. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -495,11 +495,15 @@ func (s *Server) handlePerf(w http.ResponseWriter, r *http.Request) {
|
||||
GoRuntime: func() *GoRuntimeStats {
|
||||
ms := s.getMemStats()
|
||||
return &GoRuntimeStats{
|
||||
HeapMB: float64(ms.HeapAlloc) / 1024 / 1024,
|
||||
SysMB: float64(ms.Sys) / 1024 / 1024,
|
||||
NumGoroutine: runtime.NumGoroutine(),
|
||||
Goroutines: runtime.NumGoroutine(),
|
||||
NumGC: ms.NumGC,
|
||||
GCPauseMs: float64(ms.PauseNs[(ms.NumGC+255)%256]) / 1e6,
|
||||
PauseTotalMs: float64(ms.PauseTotalNs) / 1e6,
|
||||
LastPauseMs: float64(ms.PauseNs[(ms.NumGC+255)%256]) / 1e6,
|
||||
HeapAllocMB: float64(ms.HeapAlloc) / 1024 / 1024,
|
||||
HeapSysMB: float64(ms.HeapSys) / 1024 / 1024,
|
||||
HeapInuseMB: float64(ms.HeapInuse) / 1024 / 1024,
|
||||
HeapIdleMB: float64(ms.HeapIdle) / 1024 / 1024,
|
||||
NumCPU: runtime.NumCPU(),
|
||||
}
|
||||
}(),
|
||||
})
|
||||
|
||||
+8
-4
@@ -211,11 +211,15 @@ type PerfResponse struct {
|
||||
|
||||
// GoRuntimeStats holds Go runtime metrics for the perf endpoint.
|
||||
type GoRuntimeStats struct {
|
||||
HeapMB float64 `json:"heapMB"`
|
||||
SysMB float64 `json:"sysMB"`
|
||||
NumGoroutine int `json:"numGoroutine"`
|
||||
Goroutines int `json:"goroutines"`
|
||||
NumGC uint32 `json:"numGC"`
|
||||
GCPauseMs float64 `json:"gcPauseMs"`
|
||||
PauseTotalMs float64 `json:"pauseTotalMs"`
|
||||
LastPauseMs float64 `json:"lastPauseMs"`
|
||||
HeapAllocMB float64 `json:"heapAllocMB"`
|
||||
HeapSysMB float64 `json:"heapSysMB"`
|
||||
HeapInuseMB float64 `json:"heapInuseMB"`
|
||||
HeapIdleMB float64 `json:"heapIdleMB"`
|
||||
NumCPU int `json:"numCPU"`
|
||||
}
|
||||
|
||||
// ─── Packets ───────────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user