-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[v9] Change default of onlyIncludeInstrumentedModules
in Node SDK
#14332
Comments
Looks good! We could try and detect those who will see this as a breaking change and warn them to set this to false long before v9. |
Is this possible? if so, let's do this I'd say? |
I would go with the option to flip the default for Also, I think the option to base behavior off of what |
I feel like we have to put even more clarity behind this. Some status quo for all of our supported use-cases with desired states: 1. User uses Sentry in combination with a complete custom OTEL setup:
2. User uses Sentry but wants to add individual OTEL instrumentation:
3. User uses Sentry without any custom OTEL stuff:
All of the above begs the question: Do we need the Tests we need to conduct to verify the above:
|
We settled on the following:
|
Description
Today, by default we instrument all packages with import-in-the-middle in ESM.
For v9, we may flip the default of
onlyIncludeInstrumentedModules
fromfalse
totrue
, so that by default only the things you are adding instrumentation for in the--import
hook are wrapped. This will work for everybody using the SDK to handle OTEL for them; only for users with a custom OTEL setup this may have problems.To clarify, having this flag enabled can lead to issues in rare cases, e.g. if users run
node --import instrument.mjs app.mjs
with code like this:So we have a few possible permutations here, which are unfortunate:
onlyIncludeInstrumentedModules: true
will always work and makes senseregisterEsmLoaderHooks: false
: Users have to set up their own OTEL loader hook, in which case they have to configure things like whatonlyIncludeInstrumentedModules
themselves. ✅onlyIncludeInstrumentedModules
is ignored anyhow, so default does not matter.registerEsmLoaderHooks: true
(default) andskipOpenTelemetrySetup: true
): This is the tricky scenario.There are a few possible ways we could go there:
skipOpenTelemetrySetup
,registerEsmLoaderHooks
is automaticallyfalse
(so we never set up the loader for users that doskipOpenTelemetrySetup
. While this kind of makes sense, it is definitely breaking for users of this setup (instrumentation will just stop). While setting this up yourself technically makes sense if you are shipping your own OTEL SDK, some users probably rely on us doing this for them right now.onlyIncludeInstrumentedModules
to true, and if users rely on a scenario where they register instrumentation after--import
, they need to flip this themselves. --> it's worth noting that I suspect even for custom otel setups this is a rather rare (but not impossible) scenario.onlyIncludeInstrumentedModules
depending on ifskipOpenTelemetrySetup
is enabledI think I would tend to solution 2 🤔 this is breaking but unlikely to affect a lot of users - it would only affect
a) People using a custom otel setup
b) ... who ALSO register instrumentation outside of
--import
And those people only have to flip the setting back to false to get stuff working again 🤔
The text was updated successfully, but these errors were encountered: