feat(otel): Ignore outgoing Sentry HTTP requests from otel integration#6116
Merged
feat(otel): Ignore outgoing Sentry HTTP requests from otel integration#6116
Conversation
4 tasks
Member
Author
|
Need to make sure to sync this with https://github.com/getsentry/sentry-javascript/pull/6114/files, as that also touched the map! |
mydea
commented
Nov 2, 2022
|
|
||
| beforeEach(() => { | ||
| hub = new Hub(); | ||
| const client = new NodeClient({ |
Member
Author
There was a problem hiding this comment.
@AbhiPrasad I see here: https://github.com/getsentry/sentry-javascript/pull/6114/files#diff-c10f2a296bc2f7b1e2908434ede6d48588c8add094f6270465f06fd41b35ac34R85 you added a mock client, should we do the same here? I wasn't quite sure.
Contributor
There was a problem hiding this comment.
I don't mind either way - using a mock client was faster for me, but I'm fine with creating a NodeClient here.
AbhiPrasad
approved these changes
Nov 2, 2022
Contributor
AbhiPrasad
left a comment
There was a problem hiding this comment.
Thanks for the tests!
Contributor
size-limit report 📦
|
sl0thentr0py
approved these changes
Nov 2, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With the basic setup of the SpanProcessor, you can get into an infinite loop quickly:
@opentelemetry/instrumentation-http)The "cleanest" way to avoid this is to setup your auto-instrumentation to skip Sentry requests, e.g.:
However, this also means you need to make sure to cover any potential place where this is auto-instrumented, and it also makes the setup experience for users harder than necessary.
Instead, this PR adds some handling to handle these cases automatically.
Actual solution
Any transaction/span that we identify as being an HTTP request to the configured Sentry DSN is never finished, and thus never sent to Sentry.
Known downsides
Any theoretical child spans of the Sentry HTTP request span will also never be sent to Sentry. This shouldn't actually happen that much, or be of high relevance if it happens, but it is theoretically possible.
Explanation
At least as of now, there is simply no way in
onStartof the SpanProcessor to access the attributes, as they are only set afteronStarthas been called. Because of this, any behavior where we handle this/properly filter this out before the span ends is not possible to implement.We will need to do some testing to ensure there are no memory leaks (it should be fine, but to be sure...)
ref #6112
References