Skip to content

feat(tracing): Allow empty array as tracingOrigins #5583

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

Merged
merged 1 commit into from
Aug 16, 2022

Conversation

AbhiPrasad
Copy link
Member

Fixes #5393

Allow for users to set an empty array as tracingOrigins option if they do not want to attach outgoing headers to any request. Previously we would just set the default tracing origins if users supplied an empty array.

This is technically a breaking change - but moves us toward the correct behaviour so I don't mind rolling this out in a minor. Thoughts?

Allow for users to set an empty array as `tracingOrigins` option if they
do not want to attach outgoing headers to any request.
@github-actions
Copy link
Contributor

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.39 KB (0%)
@sentry/browser - ES5 CDN Bundle (minified) 59.99 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 17.96 KB (0%)
@sentry/browser - ES6 CDN Bundle (minified) 52.88 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 19.73 KB (0%)
@sentry/browser - Webpack (minified) 64.21 KB (0%)
@sentry/react - Webpack (gzipped + minified) 19.75 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 44.38 KB (-0.02% 🔽)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 25.88 KB (-0.03% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 24.25 KB (-0.04% 🔽)

@AbhiPrasad AbhiPrasad changed the title feat(tracing): Allow for setting of an empty array feat(tracing): Allow empty array as tracingOrigins Aug 15, 2022
@Lms24
Copy link
Member

Lms24 commented Aug 16, 2022

Code-wise, this looks good to me ✅

This is technically a breaking change - but moves us toward the correct behaviour so I don't mind rolling this out in a minor. Thoughts?

So, I have a couple of thoughts on this:

  • I agree that semantically, it makes a lot of sense to me that an empty array should simply not send trace data anywhere (+ span creation ofc). So from that PoV, the change is definitely going into the right direction.
  • With the current behaviour, I think we're effectively going against the intuition of our users (albeit with a warning)
  • Therefore, to me, this provides a good base of saying that this can be seen as a fix rather than "new" behaviour
  • In terms of breakage, I made a quick GH code search and it turns out that not a lot of projects (other than sentry-js forks) actually use empty arrays. Ofc that's not the full picture but it at least somewhat tells us that the usage seems to be limited. Meaning, the impact shouldn't be too "bad".

We shouldn't forget though that,

a) this property will soon be deprecated in favour of tracePropagationTargets (where we should handle empty arrays just like this PR intends to)
b) This doesn't only influence trace data propagation but also span creation of outgoing requests (which we intend to separate from propagation with a new mechanism anyway). Not sure if this has a lot of implications for the severity of this change but I assume that it doesn't.

So IMO, let's go with this change and do it "right" in tracePropagationTargets from the start. In case we get a lot of complaints, we can still revert this and tell people to use some obscure string instead of an empty array to effectively stop sending trace data.

Let's see what the others think (we can also chat about it at daily)

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.

After discussing this at Daily, let's do this.

@AbhiPrasad
Copy link
Member Author

Note - we'll have to shout this out in the changelog.

@AbhiPrasad AbhiPrasad merged commit 4e36d26 into master Aug 16, 2022
@AbhiPrasad AbhiPrasad deleted the abhi-tracing-origins-empty-array branch August 16, 2022 16:05
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.

tracingOrigins doesn't work as expected
2 participants