Add runtime mem stats to server info (#11995)

Adds information about runtime+gc memory use.
This commit is contained in:
Klaus Post 2021-04-07 19:40:51 +02:00 committed by GitHub
parent d267d152ba
commit 48c5e7e5b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 15 deletions

View file

@ -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

View file

@ -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 {

View file

@ -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