diff --git a/CountItems/CountWorker.js b/CountItems/CountWorker.js index b3093ff4..a86ac305 100644 --- a/CountItems/CountWorker.js +++ b/CountItems/CountWorker.js @@ -54,6 +54,8 @@ class CountWorker { if (data.owner !== 'scality') { return; } + monitoring.bucketsCount.labels('error').set(0); + monitoring.bucketsCount.labels('success').set(0); switch (data.type) { case 'count': this.countItems(data.bucketInfo, (err, results) => { diff --git a/CountItems/masterProcess.js b/CountItems/masterProcess.js index 94048db1..712a21c7 100644 --- a/CountItems/masterProcess.js +++ b/CountItems/masterProcess.js @@ -62,15 +62,6 @@ const metricServer = new WebServer(8003, log).onRequest((req, res) => monitoring )); metricServer.start(); -// Set bucketsCount to 0 -monitoring.bucketsCount.labels('error').set(0); -monitoring.bucketsCount.labels('success').set(0); - -// Set objectsCount to 0 -monitoring.objectsCount.labels('error').set(0); -monitoring.objectsCount.labels('success').set(0); -monitoring.objectsCount.labels('skipped').set(0); - const handleSignal = sig => countMaster.stop(sig, () => process.exit(0)); process.on('SIGINT', handleSignal); process.on('SIGHUP', handleSignal); diff --git a/utils/S3UtilsMongoClient.js b/utils/S3UtilsMongoClient.js index ab7b3689..6ed81898 100644 --- a/utils/S3UtilsMongoClient.js +++ b/utils/S3UtilsMongoClient.js @@ -113,6 +113,11 @@ class S3UtilsMongoClient extends MongoClientInterface { let startCursorDate = new Date(); let processed = 0; + + monitoring.objectsCount.labels('error').set(0); + monitoring.objectsCount.labels('success').set(0); + monitoring.objectsCount.labels('skipped').set(0); + await cursor.forEach( res => { // Periodically display information about the cursor