Skip to content

Commit e5cc991

Browse files
committed
chore: activate sentry profiling in workers
1 parent 9f3f562 commit e5cc991

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

apps/workers/src/workers/_shared.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { NotFoundError } from '@latitude-data/core/lib/errors'
44
import { getUnknownError } from '@latitude-data/core/lib/getUnknownError'
55
import { captureException } from '$/utils/sentry'
66
import { Processor } from 'bullmq'
7-
import tracer from '../tracer'
7+
import * as Sentry from '@sentry/node'
88

99
export const buildProcessor =
1010
(queues: Queues[]): Processor =>
@@ -18,18 +18,16 @@ export const buildProcessor =
1818
const jobFn = (jobs as unknown as Record<string, Function>)[j]
1919
if (jobFn) {
2020
try {
21-
return await tracer.wrap(
22-
'bull.process',
23-
{ resource: job.name },
21+
Sentry.profiler.startProfiler()
22+
const result = await Sentry.startSpan(
23+
{ name: job.name },
2424
async () => {
25-
const span = tracer.scope().active()
26-
if (span) {
27-
span.addTags({ job_id: job.id })
28-
}
29-
3025
return await jobFn(job)
3126
},
32-
)()
27+
)
28+
Sentry.profiler.stopProfiler()
29+
30+
return result
3331
} catch (error) {
3432
const unknownError = getUnknownError(error)
3533

0 commit comments

Comments
 (0)