From 15c4252187d7f55fe697e975e127ac6d7188bff8 Mon Sep 17 00:00:00 2001 From: Mark van der Velden Date: Fri, 21 Dec 2018 18:40:12 +0100 Subject: [PATCH] Exposing several extra details --- health.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/health.go b/health.go index c6dc53c..b3d9508 100644 --- a/health.go +++ b/health.go @@ -15,7 +15,12 @@ type HealthStats struct { AllocatedMemory float64 `json:"allocatedMemory"` TotalAllocatedMemory float64 `json:"totalAllocatedMemory"` Goroutines int `json:"goroutines"` + GCCycles uint32 `json:"completedGCCycles"` NumberOfCPUs int `json:"cpus"` + HeapSys float64 `json:"maxHeapUsage"` + HeapAllocated float64 `json:"heapInUse"` + ObjectsInUse uint64 `json:"objectsInUse"` + OSMemoryObtained float64 `json:"OSMemoryObtained"` } func GetHealthStats() *HealthStats { @@ -28,6 +33,11 @@ func GetHealthStats() *HealthStats { TotalAllocatedMemory: toMegaBytes(mem.TotalAlloc), Goroutines: runtime.NumGoroutine(), NumberOfCPUs: runtime.NumCPU(), + GCCycles: mem.NumGC, + HeapSys: toMegaBytes(mem.HeapSys), + HeapAllocated: toMegaBytes(mem.HeapAlloc), + ObjectsInUse: mem.Mallocs - mem.Frees, + OSMemoryObtained: toMegaBytes(mem.Sys), } }