mirror of
https://github.com/minio/minio.git
synced 2025-02-04 02:15:59 -05:00
Remove logging info from OBDInfoHandler (#10727)
A lot of logging data is counterproductive. A better implementation with precise useful log data can be introduced later.
This commit is contained in:
parent
df9894e275
commit
858e2a43df
@ -1294,12 +1294,6 @@ func (a adminAPIHandlers) OBDInfoHandler(w http.ResponseWriter, r *http.Request)
|
|||||||
go func() {
|
go func() {
|
||||||
defer close(obdInfoCh)
|
defer close(obdInfoCh)
|
||||||
|
|
||||||
if log := query.Get("log"); log == "true" {
|
|
||||||
obdInfo.Logging.ServersLog = append(obdInfo.Logging.ServersLog, getLocalLogOBD(deadlinedCtx, r))
|
|
||||||
obdInfo.Logging.ServersLog = append(obdInfo.Logging.ServersLog, globalNotificationSys.LogOBDInfo(deadlinedCtx)...)
|
|
||||||
partialWrite(obdInfo)
|
|
||||||
}
|
|
||||||
|
|
||||||
if cpu := query.Get("syscpu"); cpu == "true" {
|
if cpu := query.Get("syscpu"); cpu == "true" {
|
||||||
cpuInfo := getLocalCPUOBDInfo(deadlinedCtx, r)
|
cpuInfo := getLocalCPUOBDInfo(deadlinedCtx, r)
|
||||||
|
|
||||||
|
@ -1113,36 +1113,6 @@ func (sys *NotificationSys) ProcOBDInfo(ctx context.Context) []madmin.ServerProc
|
|||||||
return reply
|
return reply
|
||||||
}
|
}
|
||||||
|
|
||||||
// LogOBDInfo - Logs OBD information
|
|
||||||
func (sys *NotificationSys) LogOBDInfo(ctx context.Context) []madmin.ServerLogOBDInfo {
|
|
||||||
reply := make([]madmin.ServerLogOBDInfo, len(sys.peerClients))
|
|
||||||
|
|
||||||
g := errgroup.WithNErrs(len(sys.peerClients))
|
|
||||||
for index, client := range sys.peerClients {
|
|
||||||
if client == nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
index := index
|
|
||||||
g.Go(func() error {
|
|
||||||
var err error
|
|
||||||
reply[index], err = sys.peerClients[index].LogOBDInfo(ctx)
|
|
||||||
return err
|
|
||||||
}, index)
|
|
||||||
}
|
|
||||||
|
|
||||||
for index, err := range g.Wait() {
|
|
||||||
if err != nil {
|
|
||||||
addr := sys.peerClients[index].host.String()
|
|
||||||
reqInfo := (&logger.ReqInfo{}).AppendTags("remotePeer", addr)
|
|
||||||
ctx := logger.SetReqInfo(GlobalContext, reqInfo)
|
|
||||||
logger.LogIf(ctx, err)
|
|
||||||
reply[index].Addr = addr
|
|
||||||
reply[index].Error = err.Error()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return reply
|
|
||||||
}
|
|
||||||
|
|
||||||
// ServerInfo - calls ServerInfo RPC call on all peers.
|
// ServerInfo - calls ServerInfo RPC call on all peers.
|
||||||
func (sys *NotificationSys) ServerInfo() []madmin.ServerProperties {
|
func (sys *NotificationSys) ServerInfo() []madmin.ServerProperties {
|
||||||
reply := make([]madmin.ServerProperties, len(sys.peerClients))
|
reply := make([]madmin.ServerProperties, len(sys.peerClients))
|
||||||
|
@ -148,19 +148,6 @@ func getLocalMemOBD(ctx context.Context, r *http.Request) madmin.ServerMemOBDInf
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func getLocalLogOBD(ctx context.Context, r *http.Request) madmin.ServerLogOBDInfo {
|
|
||||||
addr := r.Host
|
|
||||||
if globalIsDistErasure {
|
|
||||||
addr = GetLocalPeer(globalEndpoints)
|
|
||||||
}
|
|
||||||
|
|
||||||
log := globalConsoleSys.Content()
|
|
||||||
return madmin.ServerLogOBDInfo{
|
|
||||||
Addr: addr,
|
|
||||||
Entries: log,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func getLocalProcOBD(ctx context.Context, r *http.Request) madmin.ServerProcOBDInfo {
|
func getLocalProcOBD(ctx context.Context, r *http.Request) madmin.ServerProcOBDInfo {
|
||||||
addr := r.Host
|
addr := r.Host
|
||||||
if globalIsDistErasure {
|
if globalIsDistErasure {
|
||||||
|
@ -407,17 +407,6 @@ func (client *peerRESTClient) ProcOBDInfo(ctx context.Context) (info madmin.Serv
|
|||||||
return info, err
|
return info, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// LogOBDInfo - fetch Log OBD information for a remote node.
|
|
||||||
func (client *peerRESTClient) LogOBDInfo(ctx context.Context) (info madmin.ServerLogOBDInfo, err error) {
|
|
||||||
respBody, err := client.callWithContext(ctx, peerRESTMethodLogOBDInfo, nil, nil, -1)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
defer http.DrainBody(respBody)
|
|
||||||
err = gob.NewDecoder(respBody).Decode(&info)
|
|
||||||
return info, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// StartProfiling - Issues profiling command on the peer node.
|
// StartProfiling - Issues profiling command on the peer node.
|
||||||
func (client *peerRESTClient) StartProfiling(profiler string) error {
|
func (client *peerRESTClient) StartProfiling(profiler string) error {
|
||||||
values := make(url.Values)
|
values := make(url.Values)
|
||||||
|
@ -33,7 +33,6 @@ const (
|
|||||||
peerRESTMethodOsInfoOBDInfo = "/osinfoobdinfo"
|
peerRESTMethodOsInfoOBDInfo = "/osinfoobdinfo"
|
||||||
peerRESTMethodMemOBDInfo = "/memobdinfo"
|
peerRESTMethodMemOBDInfo = "/memobdinfo"
|
||||||
peerRESTMethodProcOBDInfo = "/procobdinfo"
|
peerRESTMethodProcOBDInfo = "/procobdinfo"
|
||||||
peerRESTMethodLogOBDInfo = "/logobdinfo"
|
|
||||||
peerRESTMethodDispatchNetOBDInfo = "/dispatchnetobdinfo"
|
peerRESTMethodDispatchNetOBDInfo = "/dispatchnetobdinfo"
|
||||||
peerRESTMethodDeleteBucketMetadata = "/deletebucketmetadata"
|
peerRESTMethodDeleteBucketMetadata = "/deletebucketmetadata"
|
||||||
peerRESTMethodLoadBucketMetadata = "/loadbucketmetadata"
|
peerRESTMethodLoadBucketMetadata = "/loadbucketmetadata"
|
||||||
|
@ -506,22 +506,6 @@ func (s *peerRESTServer) ProcOBDInfoHandler(w http.ResponseWriter, r *http.Reque
|
|||||||
logger.LogIf(ctx, gob.NewEncoder(w).Encode(info))
|
logger.LogIf(ctx, gob.NewEncoder(w).Encode(info))
|
||||||
}
|
}
|
||||||
|
|
||||||
// LogOBDInfoHandler - returns Log OBD info.
|
|
||||||
func (s *peerRESTServer) LogOBDInfoHandler(w http.ResponseWriter, r *http.Request) {
|
|
||||||
if !s.IsValid(w, r) {
|
|
||||||
s.writeErrorResponse(w, errors.New("Invalid request"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(r.Context())
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
info := getLocalLogOBD(ctx, r)
|
|
||||||
|
|
||||||
defer w.(http.Flusher).Flush()
|
|
||||||
logger.LogIf(ctx, gob.NewEncoder(w).Encode(info))
|
|
||||||
}
|
|
||||||
|
|
||||||
// MemOBDInfoHandler - returns Mem OBD info.
|
// MemOBDInfoHandler - returns Mem OBD info.
|
||||||
func (s *peerRESTServer) MemOBDInfoHandler(w http.ResponseWriter, r *http.Request) {
|
func (s *peerRESTServer) MemOBDInfoHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if !s.IsValid(w, r) {
|
if !s.IsValid(w, r) {
|
||||||
@ -1040,7 +1024,6 @@ func registerPeerRESTHandlers(router *mux.Router) {
|
|||||||
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodGetLocks).HandlerFunc(httpTraceHdrs(server.GetLocksHandler))
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodGetLocks).HandlerFunc(httpTraceHdrs(server.GetLocksHandler))
|
||||||
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodServerInfo).HandlerFunc(httpTraceHdrs(server.ServerInfoHandler))
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodServerInfo).HandlerFunc(httpTraceHdrs(server.ServerInfoHandler))
|
||||||
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodProcOBDInfo).HandlerFunc(httpTraceHdrs(server.ProcOBDInfoHandler))
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodProcOBDInfo).HandlerFunc(httpTraceHdrs(server.ProcOBDInfoHandler))
|
||||||
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodLogOBDInfo).HandlerFunc(httpTraceHdrs(server.LogOBDInfoHandler))
|
|
||||||
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodMemOBDInfo).HandlerFunc(httpTraceHdrs(server.MemOBDInfoHandler))
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodMemOBDInfo).HandlerFunc(httpTraceHdrs(server.MemOBDInfoHandler))
|
||||||
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodOsInfoOBDInfo).HandlerFunc(httpTraceHdrs(server.OsOBDInfoHandler))
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodOsInfoOBDInfo).HandlerFunc(httpTraceHdrs(server.OsOBDInfoHandler))
|
||||||
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodDiskHwOBDInfo).HandlerFunc(httpTraceHdrs(server.DiskHwOBDInfoHandler))
|
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodDiskHwOBDInfo).HandlerFunc(httpTraceHdrs(server.DiskHwOBDInfoHandler))
|
||||||
|
@ -25,7 +25,6 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/minio/minio/cmd/logger/message/log"
|
|
||||||
"github.com/minio/minio/pkg/disk"
|
"github.com/minio/minio/pkg/disk"
|
||||||
"github.com/minio/minio/pkg/net"
|
"github.com/minio/minio/pkg/net"
|
||||||
|
|
||||||
@ -43,19 +42,6 @@ type OBDInfo struct {
|
|||||||
Perf PerfOBDInfo `json:"perf,omitempty"`
|
Perf PerfOBDInfo `json:"perf,omitempty"`
|
||||||
Minio MinioOBDInfo `json:"minio,omitempty"`
|
Minio MinioOBDInfo `json:"minio,omitempty"`
|
||||||
Sys SysOBDInfo `json:"sys,omitempty"`
|
Sys SysOBDInfo `json:"sys,omitempty"`
|
||||||
Logging LogOBDInfo `json:"logging,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// LogOBDInfo holds different type of logs of all clusters
|
|
||||||
type LogOBDInfo struct {
|
|
||||||
ServersLog []ServerLogOBDInfo `json:"serverLogs"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// ServerLogOBDInfo holds server's stdout log
|
|
||||||
type ServerLogOBDInfo struct {
|
|
||||||
Addr string `json:"nodeName"`
|
|
||||||
Entries []log.Entry `json:"entries"`
|
|
||||||
Error string `json:"error,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SysOBDInfo - Includes hardware and system information of the MinIO cluster
|
// SysOBDInfo - Includes hardware and system information of the MinIO cluster
|
||||||
|
Loading…
x
Reference in New Issue
Block a user