From 85a996635ff39a40a17155e66cca22ccfce780ff Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Fri, 20 Jun 2025 14:29:27 +0800 Subject: [PATCH] add controller method for getting all metrics --- server/controllers/queueController.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/server/controllers/queueController.js b/server/controllers/queueController.js index b1a7badee..968106a5a 100755 --- a/server/controllers/queueController.js +++ b/server/controllers/queueController.js @@ -25,7 +25,7 @@ class JobQueueController { try { const jobs = await this.jobQueue.getJobs(); return res.success({ - msg: this.stringService.queueGetMetrics, + msg: this.stringService.queueGetJobs, data: jobs, }); } catch (error) { @@ -34,6 +34,20 @@ class JobQueueController { } }; + getAllMetrics = async (req, res, next) => { + try { + const jobs = await this.jobQueue.getJobs(); + const metrics = await this.jobQueue.getMetrics(); + return res.success({ + msg: this.stringService.queueGetAllMetrics, + data: { jobs, metrics }, + }); + } catch (error) { + next(handleError(error, SERVICE_NAME, "getAllMetrics")); + return; + } + }; + addJob = async (req, res, next) => { try { await this.jobQueue.addJob(Math.random().toString(36).substring(7));