fix(tracing): Fix tracingOrigins
not applying
#6079
Merged
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.
In the process of working on #5285, we missed the fact that the first two PRs (#6039 and #6041) were interdependent, in that the former accidentally introduced a bug (#6077) which the latter then inadvertently fixed. This would have been fine, except that we published a release after merging the bug-creating PR but before merging the bug-fixing PR. Whoops.
This pulls just the bug-fixing part out of the second PR. It also adds tests to cover the buggy cases, using
it.each
to cover all of the different combinations of outcomes forshouldCreateSpanForRequest
andshouldAttachHeaders
. Finally, since I was already in the test file, I reorganized it a little:it('does not create span if shouldCreateSpan returns false')
-> absorbed into theit.each()
it('does not create span if there is no fetch data in handler data')
-> added header check, becameit('adds neither fetch request spans nor fetch request headers if there is no fetch data in handler data')
it('does not add fetch request spans if tracing is disabled')
andit('does not add fetch request headers if tracing is disabled
-> combined intoit('adds neither fetch request spans nor fetch request headers if tracing is disabled')
it('adds sentry-trace header to fetch requests')
-> absorbed into theit.each()
Fixes #6077
h/t @timfish for the PR from which this is derived