Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ services:
- 3002:9090
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
extra_hosts:
- "host.docker.internal:host-gateway"
redis:
image: redis:alpine
ports:
Expand Down
6 changes: 6 additions & 0 deletions src/bull/bullmq-metrics.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ export class BullMQMetricsFactory {

queueEvents.on('stalled', async (event) => {
const job = await queue.getJob(event.jobId);
if (!job) { return; }
const jobLabels = {
[LABEL_NAMES.JOB_NAME]: job.name,
...labels,
Expand All @@ -211,6 +212,7 @@ export class BullMQMetricsFactory {
});
queueEvents.on('active', async (event) => {
const job = await queue.getJob(event.jobId);
if (!job) { return; }
const jobLabels = {
[LABEL_NAMES.JOB_NAME]: job.name,
...labels,
Expand All @@ -219,6 +221,7 @@ export class BullMQMetricsFactory {
});
queueEvents.on('waiting', async (event) => {
const job = await queue.getJob(event.jobId);
if (!job) { return; }
const jobLabels = {
[LABEL_NAMES.JOB_NAME]: job.name,
...labels,
Expand All @@ -227,6 +230,7 @@ export class BullMQMetricsFactory {
});
queueEvents.on('failed', async (event) => {
const job = await queue.getJob(event.jobId);
if (!job) { return; }
const errorType = job.stacktrace[job.stacktrace.length - 1]?.match(
/^(?<errorType>[^:]+):/,
)?.groups?.errorType;
Expand All @@ -240,6 +244,7 @@ export class BullMQMetricsFactory {
});
queueEvents.on('delayed', async (event) => {
const job = await queue.getJob(event.jobId);
if (!job) { return; }
const jobLabels = {
[LABEL_NAMES.JOB_NAME]: job.name,
...labels,
Expand All @@ -248,6 +253,7 @@ export class BullMQMetricsFactory {
});
queueEvents.on('completed', async (event) => {
const job = await queue.getJob(event.jobId);
if (!job) { return; }
const jobLabels = {
[LABEL_NAMES.JOB_NAME]: job.name,
...labels,
Expand Down