Skip to content
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(otel): Disable node tracing auto instrumentation when using otel #6144

Merged
merged 2 commits into from Nov 8, 2022

Conversation

mydea
Copy link
Member

@mydea mydea commented Nov 7, 2022

With this PR, when instrumenter: 'otel' is configured in the Node SDK, any auto-instrumentation that generates transactions is skipped.

This is a bit tricky to test, so I created a separate PR for the tests, if we don't like the approach: #6143

ref #6127

@mydea mydea requested review from AbhiPrasad and a team November 7, 2022 10:56
@mydea mydea self-assigned this Nov 7, 2022
@mydea mydea requested review from Lms24 and removed request for a team November 7, 2022 10:56
@mydea mydea force-pushed the fn/disable-node-auto-instrumentation branch from 71492a8 to 312b948 Compare November 8, 2022 13:23
Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this LGTM and I think we can merge this.

Just out of curiousity: The way I understand this, with this change we'd call setupOnce but early return if we see that the instrumenter is something else than 'sentry'. I'm wondering if we could achieve the same thing by simply removing the integrations from the list in the Node SDK's init function? You probably already thought this through so take this as a question rather than a request to change anything

@mydea
Copy link
Member Author

mydea commented Nov 8, 2022

Overall this LGTM and I think we can merge this.

Just out of curiousity: The way I understand this, with this change we'd call setupOnce but early return if we see that the instrumenter is something else than 'sentry'. I'm wondering if we could achieve the same thing by simply removing the integrations from the list in the Node SDK's init function? You probably already thought this through so take this as a question rather than a request to change anything

Honestly, there wasn't a great reason for this. There has already been some logic for "skipping" integrations in there, which is why I added onto there. But IMHO the other approach could also work well 🤔 I guess, if we remove entries after getIntegrationsToSetup in the node SDK, we can be sure that they can never be added?

So, I'm fine with either approach, really. I guess the key question is what place should "own" the decision to skip, the integration itself or a more central/global place. Let me know if you prefer the other solution, then I can also change it.

@Lms24
Copy link
Member

Lms24 commented Nov 8, 2022

As I said, I'm fine with both options as well and if there is already logic to skip in the integrations then that makes an argument to add it there as well.

The only reason I'd see to maybe do it in the init call is that custom integrations that don't check for the instrumenter could be skipped as well. Although I don't know how we want to handle that in general (maybe something we should consider for all SDKs?)

@mydea
Copy link
Member Author

mydea commented Nov 8, 2022

yeah, the tricky part is that we don't want to skip all integrations, only ones that create transactions 😅 So I don't think we can realistically filter out integrations generally (Sidenote: Kind of related to #4790, if we could split up integrations into single responsibilities and maybe even tag them somehow e.g. with a type or so, then we could actually dynamically filter them out, possibly. That would be nice!)

So, then I'd say I will go with the current approach (simply because it is done), but we maybe can/should revisit this when we (hopefully) at some point revisit integrations a bit.

@Lms24
Copy link
Member

Lms24 commented Nov 8, 2022

So, then I'd say I will go with the current approach

Sounds good to me 👍

@mydea mydea marked this pull request as ready for review November 8, 2022 14:36
Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One day we will revamp the integrations API.

and when it happens it will be a glorious :shipit:

until then we do what it takes.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 8, 2022

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.5 KB (0%)
@sentry/browser - ES5 CDN Bundle (minified) 60.37 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.15 KB (+0.02% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 53.71 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 19.89 KB (0%)
@sentry/browser - Webpack (minified) 65.12 KB (0%)
@sentry/react - Webpack (gzipped + minified) 19.92 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 45.88 KB (0%)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.3 KB (+0.01% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 24.7 KB (+0.01% 🔺)

@mydea mydea enabled auto-merge (squash) November 8, 2022 14:57
@mydea mydea merged commit 7db0b7f into master Nov 8, 2022
@mydea mydea deleted the fn/disable-node-auto-instrumentation branch November 8, 2022 15:00
@AbhiPrasad AbhiPrasad added this to the OpenTelemetry Support milestone Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants