diff --git a/packages/bull/test/bull-metrics-collector.test.js b/packages/bull/test/bull-metrics-collector.test.js index 9d8b376..7224533 100644 --- a/packages/bull/test/bull-metrics-collector.test.js +++ b/packages/bull/test/bull-metrics-collector.test.js @@ -21,6 +21,7 @@ describe('BullMetricsCollector', () => { queue = new Queue('foo') await queue.add('test-job') + await queue.add('prioritized-job', {}, { priority: 1 }) const metrics = await collector.collect() @@ -28,7 +29,7 @@ describe('BullMetricsCollector', () => { expect(metrics[0].identifier).toEqual('qd') expect(metrics[0].queueName).toEqual('foo') - expect(metrics[0].value).toEqual(1) + expect(metrics[0].value).toEqual(2) expect(metrics[1].identifier).toEqual('busy') expect(metrics[1].queueName).toEqual('foo') expect(metrics[1].value).toEqual(0) diff --git a/packages/bullmq/src/bull-mq-metrics-collector.js b/packages/bullmq/src/bull-mq-metrics-collector.js index fdc5c2f..3cd9272 100644 --- a/packages/bullmq/src/bull-mq-metrics-collector.js +++ b/packages/bullmq/src/bull-mq-metrics-collector.js @@ -16,9 +16,9 @@ class BullMQMetricsCollector extends WorkerMetricsCollector { for (const queueName of this.queueNames) { const queue = new Queue(queueName, { connection: this.redis }) - const jobCounts = await queue.getJobCounts('waiting', 'active') + const jobCounts = await queue.getJobCounts('waiting', 'active', 'prioritized') - metrics.push(new Metric('qd', new Date(), jobCounts.waiting, queueName)) + metrics.push(new Metric('qd', new Date(), jobCounts.waiting + jobCounts.prioritized, queueName)) metrics.push(new Metric('busy', new Date(), jobCounts.active, queueName)) } diff --git a/packages/bullmq/test/bull-mq-metrics-collector.test.js b/packages/bullmq/test/bull-mq-metrics-collector.test.js index a13e505..8b164e8 100644 --- a/packages/bullmq/test/bull-mq-metrics-collector.test.js +++ b/packages/bullmq/test/bull-mq-metrics-collector.test.js @@ -26,6 +26,7 @@ describe('BullMQMetricsCollector', () => { const queue = new Queue('foo', { connection: collector.redis }) await queue.add('test-job') + await queue.add('prioritized-job', {}, { priority: 1 }) const metrics = await collector.collect() @@ -33,7 +34,7 @@ describe('BullMQMetricsCollector', () => { expect(metrics[0].identifier).toEqual('qd') expect(metrics[0].queueName).toEqual('foo') - expect(metrics[0].value).toEqual(1) + expect(metrics[0].value).toEqual(2) expect(metrics[1].identifier).toEqual('busy') expect(metrics[1].queueName).toEqual('foo') expect(metrics[1].value).toEqual(0)