-
Notifications
You must be signed in to change notification settings - Fork 1
poc(sentry): send events from a separate thread #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is dope. If we find that this has a noticeable impact, we should probably upstream these changes into the Node SDK so it becomes the default.
return () => { | ||
return { | ||
send: (envelope) => { | ||
worker.postMessage(envelope); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only concern here is that there might be some back-pressure issues here in high volume scenarios, but that should be no problem with the volume we have with jest
let transport = makeNodeTransport({}); | ||
|
||
parentPort.on("message", (message) => { | ||
transport.send(envelope); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have to make envelope -> message here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes, we def should.
@AbhiPrasad I actually have a blocking problem here - the SDK's makeNodeTransport factory functions expects an object with |
return () => { | ||
return { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move constructing the worker here, then we can pass down the URL as a argv
to the Worker
constructor. That should make it easy to pass down the url right? (since the function returning should get url as an option).
This is a poc of sending events to sentry via worker thread. The hypothesis is that currently, jest cannot move to the next test file while a promise is pending, offloading that to a separate thread would allow it to keep executing test files and enqueuing network requests on a separate thread.
Before continuing with the idea, I would like to investigate in optimizing some transport params first.