From 3a0125fa1f94a47efc19523363684486e89d9298 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 21 Aug 2023 14:25:24 -0700 Subject: [PATCH] remove unexpected logging from peer calls (#17888) also make sure RequestID is set for system logs --- cmd/data-scanner.go | 1 - cmd/peer-rest-client.go | 8 -------- internal/logger/logger.go | 5 ++++- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/cmd/data-scanner.go b/cmd/data-scanner.go index 941a1541d..a53d8ad28 100644 --- a/cmd/data-scanner.go +++ b/cmd/data-scanner.go @@ -550,7 +550,6 @@ func (f *folderScanner) scanFolder(ctx context.Context, folder cachedFolder, int dst = &dataUsageEntry{Compacted: false} } if err := f.scanFolder(ctx, folder, dst); err != nil { - logger.LogIf(ctx, err) return } if !into.Compacted { diff --git a/cmd/peer-rest-client.go b/cmd/peer-rest-client.go index b62cad3e6..cfc2add9b 100644 --- a/cmd/peer-rest-client.go +++ b/cmd/peer-rest-client.go @@ -488,12 +488,10 @@ func (client *peerRESTClient) BackgroundHealStatus() (madmin.BgHealState, error) func (client *peerRESTClient) GetLocalDiskIDs(ctx context.Context) (diskIDs []string) { respBody, err := client.callWithContext(ctx, peerRESTMethodGetLocalDiskIDs, nil, nil, -1) if err != nil { - logger.LogIf(ctx, err) return nil } defer xhttp.DrainBody(respBody) if err = gob.NewDecoder(respBody).Decode(&diskIDs); err != nil { - logger.LogIf(ctx, err) return nil } return diskIDs @@ -513,7 +511,6 @@ func (client *peerRESTClient) GetMetacacheListing(ctx context.Context, o listPat } respBody, err := client.callWithContext(ctx, peerRESTMethodGetMetacacheListing, nil, &reader, int64(reader.Len())) if err != nil { - logger.LogIf(ctx, err) return nil, err } var resp metacache @@ -532,7 +529,6 @@ func (client *peerRESTClient) UpdateMetacacheListing(ctx context.Context, m meta } respBody, err := client.callWithContext(ctx, peerRESTMethodUpdateMetacacheListing, nil, bytes.NewBuffer(b), int64(len(b))) if err != nil { - logger.LogIf(ctx, err) return m, err } defer xhttp.DrainBody(respBody) @@ -543,7 +539,6 @@ func (client *peerRESTClient) UpdateMetacacheListing(ctx context.Context, m meta func (client *peerRESTClient) ReloadPoolMeta(ctx context.Context) error { respBody, err := client.callWithContext(ctx, peerRESTMethodReloadPoolMeta, nil, nil, 0) if err != nil { - logger.LogIf(ctx, err) return err } defer xhttp.DrainBody(respBody) @@ -553,7 +548,6 @@ func (client *peerRESTClient) ReloadPoolMeta(ctx context.Context) error { func (client *peerRESTClient) StopRebalance(ctx context.Context) error { respBody, err := client.callWithContext(ctx, peerRESTMethodStopRebalance, nil, nil, 0) if err != nil { - logger.LogIf(ctx, err) return err } defer xhttp.DrainBody(respBody) @@ -565,7 +559,6 @@ func (client *peerRESTClient) LoadRebalanceMeta(ctx context.Context, startRebala values.Set(peerRESTStartRebalance, strconv.FormatBool(startRebalance)) respBody, err := client.callWithContext(ctx, peerRESTMethodLoadRebalanceMeta, values, nil, 0) if err != nil { - logger.LogIf(ctx, err) return err } defer xhttp.DrainBody(respBody) @@ -575,7 +568,6 @@ func (client *peerRESTClient) LoadRebalanceMeta(ctx context.Context, startRebala func (client *peerRESTClient) LoadTransitionTierConfig(ctx context.Context) error { respBody, err := client.callWithContext(ctx, peerRESTMethodLoadTransitionTierConfig, nil, nil, 0) if err != nil { - logger.LogIf(ctx, err) return err } defer xhttp.DrainBody(respBody) diff --git a/internal/logger/logger.go b/internal/logger/logger.go index d201b2875..610b7c380 100644 --- a/internal/logger/logger.go +++ b/internal/logger/logger.go @@ -268,7 +268,10 @@ func errToEntry(ctx context.Context, err error, errKind ...interface{}) log.Entr req := GetReqInfo(ctx) if req == nil { - req = &ReqInfo{API: "SYSTEM"} + req = &ReqInfo{ + API: "SYSTEM", + RequestID: fmt.Sprintf("%X", time.Now().UTC().UnixNano()), + } } req.RLock() defer req.RUnlock()