diff --git a/src/middlewares/metrics.js b/src/middlewares/metrics.js index 1f562ed..b133127 100644 --- a/src/middlewares/metrics.js +++ b/src/middlewares/metrics.js @@ -6,8 +6,18 @@ const queue = require('../queue'); const isEnabled = config.get('metrics:enabled'); const prometheusBundle = isEnabled ? promBundle({ - includePath: true, + includePath: false, includeMethod: true, + formatStatusCode: (status) => { + // Custom logic to format the status code + if (status >= 400 && status < 500) { + return '4xx'; + } else if (status >= 500) { + return '5xx'; + } else { + return '2xx'; + } + }, autoregister: false, // Do not register the metrics endpoint promClient: { collectDefaultMetrics: {},