Skip to content

Commit

Permalink
fixups post reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
benzekrimaha committed May 14, 2024
1 parent 832d892 commit 5b7f15a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions utils/monitoring.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 5b7f15a

Please sign in to comment.