Update minio_node_bucket_scans_finished metrics (#17006)

This commit is contained in:
Krishnan Parthasarathi 2023-04-11 19:21:34 -07:00 committed by GitHub
parent 10693fddfa
commit 6877578bbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) { func (s *xlStorage) NSScanner(ctx context.Context, cache dataUsageCache, updates chan<- dataUsageEntry, scanMode madmin.HealScanMode) (dataUsageCache, error) {
atomic.AddInt32(&s.scanning, 1) atomic.AddInt32(&s.scanning, 1)
defer 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. // Updates must be closed before we return.
defer close(updates) defer close(updates)
var lc *lifecycle.Lifecycle var lc *lifecycle.Lifecycle
var err error
// Check if the current bucket has a configured lifecycle policy // Check if the current bucket has a configured lifecycle policy
if globalLifecycleSys != nil { if globalLifecycleSys != nil {