From 6877578bbcef4c35ef6181a3d888faaa5e3922b9 Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Tue, 11 Apr 2023 19:21:34 -0700 Subject: [PATCH] Update minio_node_bucket_scans_finished metrics (#17006) --- cmd/xl-storage.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 {