-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
feat(node): Add docs for async context apis #6641
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
Looks great! I'm curious why you chose Koa as the example to show this on.
Co-authored-by: Shana Matthews <shana.l.matthews@gmail.com>
We actually don't have a koa integration, so the koa docs are a guide on how to manually instrument the framework with sentry. The example with |
}, | ||
}); | ||
Sentry.runWithAsyncContext( | ||
async hub => { |
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.
A question about this API: Why do we pass the hub as argument? Couldn't we just tell users to call Sentry.getCurrentHub()
inside instead?
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.
We discussed offline and decided this was fine, since very few people are going to use this API anyway.
ref getsentry/sentry-javascript#7691
ref getsentry/sentry-javascript#7817
In the new upcoming version of the Node SDK, we now expose an API allowing users to isolate their requests to prevent breadcrumbs/tags/spans from leaking across requests. This PR documents that.
Before users had to manually use Node's domains API to do this, but now we've abstracted this away from them. To make this easier, we've updated the Koa docs to stop using domains directly, but instead use the new
runWithAsyncContext
API.Note: only merge when
7.48.0
is released.