diff --git a/CountItems/CountMaster.js b/CountItems/CountMaster.js index 30f33de0..afd8fd90 100644 --- a/CountItems/CountMaster.js +++ b/CountItems/CountMaster.js @@ -58,7 +58,7 @@ class CountMaster { this.log.info('got buckets infos', { bucketCount: bucketList.bucketCount, }); - // monitoring.bucketCount.set(bucketList.bucketCount); + monitoring.bucketCount.set(bucketList.bucketCount); this.manager.addWork(bucketList); return next(); }), diff --git a/CountItems/masterProcess.js b/CountItems/masterProcess.js index 0115b220..23beab7f 100644 --- a/CountItems/masterProcess.js +++ b/CountItems/masterProcess.js @@ -43,7 +43,7 @@ const countMaster = new CountMaster({ }); metricServer.onRequest((req, res) => monitoring.metricsHandler( - countMaster.stop(null, () => process.exit(1)), + countMaster.stop.bind(countMaster), req, res, )); diff --git a/utils/monitoring.js b/utils/monitoring.js index a047bb3d..4f1bf10d 100644 --- a/utils/monitoring.js +++ b/utils/monitoring.js @@ -6,7 +6,8 @@ const CountMaster = require('../CountItems/CountMaster'); const aggregatorRegistry = new promClient.AggregatorRegistry(); const { collectDefaultMetrics } = promClient; -const bucketCount = new promClient.Gauge({ +const bucketCount = (promClient.register.getSingleMetric('bucketCount_metrics')) + ||new promClient.Gauge({ name: 'bucketCount_metrics', help: 'Total number of buckets', labelNames: ['bucketName'],