From 5b7f15a750eb30d1dda2b2ed562563334cca9e57 Mon Sep 17 00:00:00 2001 From: Maha Benzekri Date: Tue, 14 May 2024 16:56:03 +0200 Subject: [PATCH] fixups post reviews --- utils/monitoring.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/monitoring.js b/utils/monitoring.js index 42008da3..ce934e27 100644 --- a/utils/monitoring.js +++ b/utils/monitoring.js @@ -28,7 +28,7 @@ const consolidationDuration = (promClient.register.getSingleMetric('count_items_ name: 'count_items_consolidationDuration', help: 'Duration of metrics consolidation in seconds', labelNames: ['service'], - buckets: [0.1, 0.5, 1, 2, 5, 10], + buckets: [0.01, 0.05, 0.1, 0.2, 0.5, 1, 1.5, 2], }); const workersCount = (promClient.register.getSingleMetric('count_items_workersCountErrors')) @@ -53,13 +53,13 @@ const metricsCount = (promClient.register.getSingleMetric('count_items_metricsCo }); /** * @param {http.ServerResponse} res - http response object - * @param {errors.ArsenalError} error - Error code + * @param {Error | errors.ArsenalError} error - Error * @return {void} */ function _writeResponse(res, error) { let statusCode = 200; if (error) { - if (Number.isInteger(error.code)) { + if (error instanceof errors.ArsenalError && Number.isInteger(error.code)) { statusCode = error.code; } else { statusCode = 500; @@ -92,7 +92,7 @@ async function metricsHandler(countMasterInstance, onScraped, req, res) { 'content-type': promClient.register.contentType, }).end(promMetrics); } catch (ex) { - return _writeResponse(res, errors.MethodNotAllowed); + return _writeResponse(res, ex); } finally { if (CountMaster.waitingForPromScraping === true) { countMasterInstance.stop(null, onScraped);