Open dtinth opened 2 years ago
How is the development progress now? I also encountered this problem. In the projects using bull, some logs have traceid and some do not.
+1
+1
+1
+1
+1
Hi is there anyone going through with this? I would like to contribute if possible
+1
+1
See https://github.com/DataDog/dd-trace-js/issues/3577 for potential workarounds
+1
This post was very helpful. Here's how I ended up doing it in my worker base class:
new Worker(
queueName,
async (job) => {
// Wrap job processing for tracing
return await tracer.wrap(
"bullmq.process",
{ resource: job.name },
async () => {
const span = tracer.scope().active();
if (span) {
span.addTags({
jobId: job.id,
jobName: job.name,
queueName: queueName,
});
}
// Run the job
return await this.handleJob(
job.name,
job.data,
job.id || "anonymous",
);
},
)();
},
/* other stuff */
);
Bull is a Node.js task queue package with over 300k weekly downloads and over 11k stargazers.
Workaround
We at @opn-ooo are currently integrating with Bull queue manually by monkey-patching the Bull
queue.process
function after creating like this:Note that this workaround requires the processing function to be written using
async function
or a function that returns a promise. Thedone
callback pattern is not supported.