-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(node-core): Add node-core SDK #16745
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: develop
Are you sure you want to change the base?
Conversation
cf84c54
to
9fd7337
Compare
size-limit report 📦
|
610c5cc
to
8b31e19
Compare
This comment was marked as outdated.
This comment was marked as outdated.
3d127cf
to
b97edd4
Compare
|
||
setTimeout(() => { | ||
process.exit(); | ||
}, 20000); |
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.
@timfish I had to increase the timeout here to get these to pass. Could you have a look why that might be?
I'm wondering if the OTel init outside of Sentry.init has something to do with this.
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.
Seems unlikely this has anything to do with otel because the anr events are sent from another thread without the full SDK running. I wouldn't worry too much about this change!
Can you use |
|
||
## Usage | ||
|
||
Sentry should be initialized as early in your app as possible. It is essential that you call `Sentry.init` before you |
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.
Should we emphasize that OTEL setup is required? What happens if users don't set up OTEL?
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.
I updated the README. If users don't setup OTel they basically get only basic error logging, no scope isolation.
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.
follow up: Maybe we can get to a place where we can have basic scope isolation for errors without otel 🤔 but that's a bigger topic 😅
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.
why isn't this file also just moved from @sentry/node
?
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.
The one in @sentry/node
uses @opentelemetry/instrumentation-http
, while the one in node-core does not.
]; | ||
const nodeCoreIntegrations = getNodeCoreDefaultIntegrations(); | ||
|
||
// Filter out the node-core HTTP and NodeFetch integrations and replace them with Node SDK's composite versions |
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.
I wonder if we'll have issues where people import node-core and use those integrations with the node sdk. Maybe we need a way to detect those scenarios?
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.
Could be an issue, but most people won't use @sentry/node-core
. Same as most people don't use @sentry/core
. Not sure we need to guard against this at this point?
Do you have some specific approach in mind?
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 already have a similar thing for e.g. browserTracingIntegration
where many SDKs export a different implementation of this than the browser one 🤔 so I think this should be fine...?
Co-authored-by: Abhijeet Prasad <aprasad@sentry.io>
This PR adds a new
@sentry/node-core
SDK and refactors@sentry/node
to build on it. It provides the core functionality of the Node SDK with a few key differences@opentelemetry/instrumentation-X
)@sentry/node
APIs (minus the OpenTelemetry instrumentations)When to Use Each
This SDK is not intended to be used by most users directly (similarly to
@sentry/core
). It provides core functionality and makes it possible to be used in setups where OpenTelemetry dependencies that do not match those we set up in the more opinionated@sentry/node
SDK.Use
@sentry/node-core
when:Use
@sentry/node
when:Example setup
Sentry should be initialized as early in your app as possible. It is essential that you call
Sentry.init
before yourequire any other modules in your application, otherwise any auto-instrumentation will not work.
You also need to set up OpenTelemetry, if you prefer not to, consider using the
@sentry/node
SDK instead.You need to create a file named
instrument.js
that imports and initializes Sentry: