Skip to content

Commit f4de6a0

Browse files
committed
feat(store): force a new Sentry trace id for job
1 parent 6ca6806 commit f4de6a0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/store/src/queue-worker.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
isNil,
88
newEvent,
99
newLogger,
10+
uuid,
1011
} from "@compas/stdlib";
1112
import cron from "cron-parser";
1213
import { jobWhere } from "./generated/database/job.js";
@@ -511,10 +512,14 @@ async function queueWorkerExecuteJob(logger, sql, options, job) {
511512
if (_compasSentryExport) {
512513
await _compasSentryExport.startSpan(
513514
{
515+
// Force a new trace for every request. This keeps the traces view usable.
516+
traceId: uuid().replace(/-/g, ""),
517+
spanId: uuid().replace(/-/g, "").slice(16),
518+
forceTransaction: true,
519+
514520
op: "queue.task",
515521
name: job.name,
516522
description: job.name,
517-
forceTransaction: true,
518523
},
519524
async () => {
520525
return await exec();

0 commit comments

Comments
 (0)