Add workspace id in job logs (#19764)

Cannot currently investigate spikes
This commit is contained in:
Thomas Trompette
2026-04-16 17:28:37 +02:00
committed by GitHub
parent 4f4f723ed0
commit 446a3923f2
2 changed files with 12 additions and 3 deletions
@@ -111,16 +111,20 @@ export class BullMQDriver
async (job) => {
// TODO: Correctly support for job.id
const timeStart = performance.now();
const workspaceId = job.data?.workspaceId;
const workspaceSuffix = workspaceId
? ` [workspace=${workspaceId}]`
: '';
this.logger.log(
`Processing job ${job.id} with name ${job.name} on queue ${queueName}`,
`Processing job ${job.id} with name ${job.name} on queue ${queueName}${workspaceSuffix}`,
);
await handler({ data: job.data, id: job.id ?? '', name: job.name });
const timeEnd = performance.now();
const executionTime = timeEnd - timeStart;
this.logger.log(
`Job ${job.id} with name ${job.name} processed on queue ${queueName} in ${executionTime.toFixed(2)}ms`,
`Job ${job.id} with name ${job.name} processed on queue ${queueName} in ${executionTime.toFixed(2)}ms${workspaceSuffix}`,
);
},
workerOptions,