Exposing several extra details

This commit is contained in:
Mark van der Velden 2018-12-21 18:40:12 +01:00
parent d4e99aeef7
commit 15c4252187
No known key found for this signature in database
GPG Key ID: C3DE78B7CDE2A243
1 changed files with 10 additions and 0 deletions

View File

@ -15,7 +15,12 @@ type HealthStats struct {
AllocatedMemory float64 `json:"allocatedMemory"` AllocatedMemory float64 `json:"allocatedMemory"`
TotalAllocatedMemory float64 `json:"totalAllocatedMemory"` TotalAllocatedMemory float64 `json:"totalAllocatedMemory"`
Goroutines int `json:"goroutines"` Goroutines int `json:"goroutines"`
GCCycles uint32 `json:"completedGCCycles"`
NumberOfCPUs int `json:"cpus"` NumberOfCPUs int `json:"cpus"`
HeapSys float64 `json:"maxHeapUsage"`
HeapAllocated float64 `json:"heapInUse"`
ObjectsInUse uint64 `json:"objectsInUse"`
OSMemoryObtained float64 `json:"OSMemoryObtained"`
} }
func GetHealthStats() *HealthStats { func GetHealthStats() *HealthStats {
@ -28,6 +33,11 @@ func GetHealthStats() *HealthStats {
TotalAllocatedMemory: toMegaBytes(mem.TotalAlloc), TotalAllocatedMemory: toMegaBytes(mem.TotalAlloc),
Goroutines: runtime.NumGoroutine(), Goroutines: runtime.NumGoroutine(),
NumberOfCPUs: runtime.NumCPU(), NumberOfCPUs: runtime.NumCPU(),
GCCycles: mem.NumGC,
HeapSys: toMegaBytes(mem.HeapSys),
HeapAllocated: toMegaBytes(mem.HeapAlloc),
ObjectsInUse: mem.Mallocs - mem.Frees,
OSMemoryObtained: toMegaBytes(mem.Sys),
} }
} }