From d281ebb178a9c1b51f74cd61afbdf16c1ca5f1f8 Mon Sep 17 00:00:00 2001 From: Vladimir Varankin Date: Tue, 28 Mar 2023 20:47:18 +0200 Subject: [PATCH] web: display GOMEMLIMIT in runtime info Signed-off-by: Vladimir Varankin --- web/api/v1/api.go | 1 + web/web.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/web/api/v1/api.go b/web/api/v1/api.go index c43f4573a..e1168e1a6 100644 --- a/web/api/v1/api.go +++ b/web/api/v1/api.go @@ -143,6 +143,7 @@ type RuntimeInfo struct { CorruptionCount int64 `json:"corruptionCount"` GoroutineCount int `json:"goroutineCount"` GOMAXPROCS int `json:"GOMAXPROCS"` + GOMEMLIMIT int64 `json:"GOMEMLIMIT"` GOGC string `json:"GOGC"` GODEBUG string `json:"GODEBUG"` StorageRetention string `json:"storageRetention"` diff --git a/web/web.go b/web/web.go index c8a32e0a6..27378b3b8 100644 --- a/web/web.go +++ b/web/web.go @@ -29,6 +29,7 @@ import ( "path" "path/filepath" "runtime" + "runtime/debug" "strconv" "strings" "sync" @@ -710,6 +711,7 @@ func (h *Handler) runtimeInfo() (api_v1.RuntimeInfo, error) { CWD: h.cwd, GoroutineCount: runtime.NumGoroutine(), GOMAXPROCS: runtime.GOMAXPROCS(0), + GOMEMLIMIT: debug.SetMemoryLimit(-1), GOGC: os.Getenv("GOGC"), GODEBUG: os.Getenv("GODEBUG"), }