From 48c5e7e5b62932c2702dcfcb2c58c582cab0ed0f Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Wed, 7 Apr 2021 19:40:51 +0200 Subject: [PATCH] Add runtime mem stats to server info (#11995) Adds information about runtime+gc memory use. --- cmd/admin-handlers.go | 15 --------------- cmd/admin-server-info.go | 2 ++ pkg/madmin/info-commands.go | 2 ++ 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/cmd/admin-handlers.go b/cmd/admin-handlers.go index 04b343b72..7b61a3e82 100644 --- a/cmd/admin-handlers.go +++ b/cmd/admin-handlers.go @@ -271,21 +271,6 @@ type ServerHTTPStats struct { TotalS3RejectedInvalid uint64 `json:"totalS3RejectedInvalid"` } -// ServerInfoData holds storage, connections and other -// information of a given server. -type ServerInfoData struct { - ConnStats ServerConnStats `json:"network"` - HTTPStats ServerHTTPStats `json:"http"` - Properties ServerProperties `json:"server"` -} - -// ServerInfo holds server information result of one node -type ServerInfo struct { - Error string `json:"error"` - Addr string `json:"addr"` - Data *ServerInfoData `json:"data"` -} - // StorageInfoHandler - GET /minio/admin/v3/storageinfo // ---------- // Get server information diff --git a/cmd/admin-server-info.go b/cmd/admin-server-info.go index 49bc0182f..294e2fc51 100644 --- a/cmd/admin-server-info.go +++ b/cmd/admin-server-info.go @@ -19,6 +19,7 @@ package cmd import ( "context" "net/http" + "runtime" "time" "github.com/minio/minio/cmd/logger" @@ -67,6 +68,7 @@ func getLocalServerProperty(endpointServerPools EndpointServerPools, r *http.Req CommitID: CommitID, Network: network, } + runtime.ReadMemStats(&props.MemStats) objLayer := newObjectLayerFn() if objLayer != nil && !globalIsGateway { diff --git a/pkg/madmin/info-commands.go b/pkg/madmin/info-commands.go index b6a7970af..db8f4bb1a 100644 --- a/pkg/madmin/info-commands.go +++ b/pkg/madmin/info-commands.go @@ -21,6 +21,7 @@ import ( "context" "encoding/json" "net/http" + "runtime" "time" ) @@ -316,6 +317,7 @@ type ServerProperties struct { Network map[string]string `json:"network,omitempty"` Disks []Disk `json:"drives,omitempty"` PoolNumber int `json:"poolNumber,omitempty"` + MemStats runtime.MemStats `json:"mem_stats"` } // DiskMetrics has the information about XL Storage APIs