diff --git a/cmd/xl-storage.go b/cmd/xl-storage.go index 5ed047de5..85b01152d 100644 --- a/cmd/xl-storage.go +++ b/cmd/xl-storage.go @@ -435,11 +435,19 @@ func (s *xlStorage) readMetadata(ctx context.Context, itemPath string) ([]byte, func (s *xlStorage) NSScanner(ctx context.Context, cache dataUsageCache, updates chan<- dataUsageEntry, scanMode madmin.HealScanMode) (dataUsageCache, error) { atomic.AddInt32(&s.scanning, 1) defer atomic.AddInt32(&s.scanning, -1) + var err error + stopFn := globalScannerMetrics.log(scannerMetricScanBucketDrive, s.diskPath, cache.Info.Name) + defer func() { + res := make(map[string]string) + if err != nil { + res["err"] = err.Error() + } + stopFn(res) + }() // Updates must be closed before we return. defer close(updates) var lc *lifecycle.Lifecycle - var err error // Check if the current bucket has a configured lifecycle policy if globalLifecycleSys != nil {