feat(node)!: split childProcess integration into childProcess and worker integrations - #22886
Conversation
bab9d05 to
add0cf9
Compare
JPeer264
left a comment
There was a problem hiding this comment.
It also seems that the build and the lint is failing. You can check out our CONTRIBUTING.md how to run yarn build and yarn lint
| * @deprecated Use `workerIntegration({ captureWorkerErrors })` instead. | ||
| * This option is no longer used by childProcessIntegration. | ||
| */ | ||
| captureWorkerErrors?: boolean; |
There was a problem hiding this comment.
m: You can remove that entire option. Everything on develop can be breaking right now.
| * | ||
| * @default true | ||
| */ | ||
| captureWorkerErrors?: boolean; |
There was a problem hiding this comment.
m: IMO we can remove the option entirely and make it only capturing errors. If they don't want to have it as an error they could opt-out of this integration. If there is a need again in the future for having that option, we could always re-add it. But less code is better here.
| captureWorkerErrors?: boolean; | ||
| } | ||
|
|
||
| const INTEGRATION_NAME = 'Worker' as const; |
There was a problem hiding this comment.
That would make more sense IMO. Please also rename the integration (and file) to workerThreadsIntegration. Who knows what comes in the future that is a "worker" 😅
| const INTEGRATION_NAME = 'Worker' as const; | |
| const INTEGRATION_NAME = 'WorkerThreads' as const; |
add0cf9 to
3267dd3
Compare
3267dd3 to
886e88b
Compare
|
Hi @JPeer264, thanks for the review. I've addressed the feedback:
CI is queued but the workflow needs maintainer approval to run. Could you approve it so the build and tests can validate? |
886e88b to
0c0a9b0
Compare
0c0a9b0 to
32eb52d
Compare
|
Apologies for the back and forth on this, the failures were on my end. The issues should all be resolved now:
All the review feedback is addressed (option removal, rename, astro export, tests, docs). Could you approve the workflow again so we can get the remaining checks green and proceed @JPeer264 ? |
JPeer264
left a comment
There was a problem hiding this comment.
Amazing thanks a lot for the contribution. LGTM
Waiting for one more review just in case I missed something
32eb52d to
b8fbdf6
Compare
32eb52d to
326f5a2
Compare
Thanks @JPeer264 much appreciated , i noticed the pipeline ran around 40 mins ago failed - one Node 26 integration test : suites/breadcrumbs/process-thread (ESM). It expects the worker thread error event to arrive before the thrown test error, but on Node 26 the order occasionally flips as it doesn't happen locally with me. Do we have to do something about it ? Also as the branch was outdated , I have rebased with the latest dev |
326f5a2 to
fae8cfd
Compare
fae8cfd to
61d2126
Compare
61d2126 to
0de8eab
Compare
|
Hi @chargome this is approved and ready for merge. Could you take a second look and merge if it looks good? |
…ads integrations Splits worker thread handling out of childProcessIntegration into a new workerThreadsIntegration. The deprecated captureWorkerErrors option is removed from both integrations; worker thread errors are now always captured. Exports the new integration from the astro server barrel and updates the e2e tests to expect worker thread error events with the auto.worker_thread mechanism. Uses unordered event matching in the process-thread e2e test since the two captured events can arrive in either order. Updates MIGRATION.md for the rename. Fixes getsentry#18698 Signed-off-by: Atharv Pandey <atharvpandey245@gmail.com>
0de8eab to
9fef2d9
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9fef2d9. Configure here.
|
Hi @JPeer264, this is approved and rebased on latest develop. Could you merge when you get a chance? |
|
Hey. I was just about to fix that one test and change the origin. I'll push that real quick and merge this |
…kerThreads integrations
| threadId = worker.threadId; | ||
| }) | ||
| .on('error', error => { | ||
| captureException(error, { | ||
| mechanism: { | ||
| type: 'auto.node.worker_threads', | ||
| handled: false, | ||
| data: threadId !== undefined ? { threadId: String(threadId) } : undefined, | ||
| }, | ||
| }); | ||
| }); |
There was a problem hiding this comment.
Bug: The threadId is not captured for worker error events if the worker fails to initialize, as it's only set after the 'online' event fires.
Severity: LOW
Suggested Fix
The worker.threadId property is available immediately after the worker object is created. Capture worker.threadId right after the new Worker(...) call, before any event listeners are attached, to ensure it's available for all events, including initialization errors.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: packages/node/src/integrations/workerThreads.ts#L24-L39
Potential issue: In the `captureWorkerThreadEvents` function, the `threadId` is only
cached within the 'online' event handler. If a worker fails to initialize due to an
error, such as a syntax error or a missing module, the 'error' event will fire before
the 'online' event. In this scenario, the local `threadId` variable remains `undefined`,
and the error event is captured without the `threadId` in its mechanism data. This makes
debugging worker initialization failures more difficult as the specific thread cannot be
identified.
|
@atharv-sys32 thanks again for your patience and your contributions. Since this is a breaking change this will only land in v11 (and ofc our next alpha of v11) |

Split worker thread handling out of
childProcessIntegrationinto a newworkerThreadsIntegration.Previously
childProcessIntegrationcaptured both child process and worker thread events. Now:childProcessIntegration()handles child process breadcrumbs only.workerThreadsIntegration()(wasworkerIntegration) captures worker thread errors with anauto.worker_threadmechanism.The deprecated
captureWorkerErrorsoption is removed from both integrations per review feedback; worker thread errors are always captured.Fixes #18698