Skip to content

Commit

Permalink
chore: exec lint:fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Tkacz authored and CatchMe2 committed Aug 6, 2024
1 parent b4030c0 commit 115cd7d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 5 additions & 5 deletions lib/plugins/bull-mq-metrics/ObservableQueue.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Queue, QueueEvents } from 'bullmq'
import type { FinishedStatus } from "bullmq";
import type { FinishedStatus } from 'bullmq'
import type { FastifyBaseLogger } from 'fastify'
import type { Redis } from 'ioredis'

Expand All @@ -18,13 +18,13 @@ export class ObservableQueue {
}

this.metrics.finishedDuration
.labels({ status, queue: this.name })
.observe(job.finishedOn - job.timestamp)
.labels({ status, queue: this.name })
.observe(job.finishedOn - job.timestamp)

if (job.processedOn) {
this.metrics.processedDuration
.labels({ status, queue: this.name })
.observe(job.finishedOn - job.processedOn)
.labels({ status, queue: this.name })
.observe(job.finishedOn - job.processedOn)
}
} catch (err) {
this.logger.warn(err)
Expand Down
8 changes: 6 additions & 2 deletions lib/plugins/bullMqMetricsPlugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ describe('bullMqMetricsPlugin', () => {
await app.bullMqMetrics.collect()

const responseBefore = await getMetrics()
expect(responseBefore.result.body).not.toContain('bullmq_jobs_finished_duration_count{status="completed",queue="test_job"} 1')
expect(responseBefore.result.body).not.toContain(
'bullmq_jobs_finished_duration_count{status="completed",queue="test_job"} 1',
)

await processor.schedule({
metadata: {
Expand All @@ -151,6 +153,8 @@ describe('bullMqMetricsPlugin', () => {
await app.bullMqMetrics.collect()

const responseAfter = await getMetrics()
expect(responseAfter.result.body).toContain('bullmq_jobs_finished_duration_count{status="completed",queue="test_job"} 1')
expect(responseAfter.result.body).toContain(
'bullmq_jobs_finished_duration_count{status="completed",queue="test_job"} 1',
)
})
})

0 comments on commit 115cd7d

Please sign in to comment.