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

fix(tracing): Don't consider tracingOrigins when creating spans #6039

Conversation

timfish
Copy link
Collaborator

@timfish timfish commented Oct 25, 2022

Ap per Katie's summary here, tracing origins should not be considered when creating spans.

Current span creation

tracingOrigins match no tracingOrigins match
shouldCreateSpanForRequest returns true ❌ *
shouldCreateSpanForRequest returns false
shouldCreateSpanForRequest is undefined ❌ *
  • These are incorrect and should result in span creation. In that case, tracingOrigins does not matter.

After this PR

Create span?
shouldCreateSpanForRequest returns true
shouldCreateSpanForRequest returns false
shouldCreateSpanForRequest is undefined

@AbhiPrasad AbhiPrasad self-requested a review October 25, 2022 14:05
@timfish timfish marked this pull request as ready for review October 25, 2022 14:16
@AbhiPrasad
Copy link
Member

I guess this would be a breaking change then right? But it's more correct behavior, so I'd be fine with keeping it.

@timfish
Copy link
Collaborator Author

timfish commented Oct 25, 2022

Yep, my comment further down the linked issue mentions just that. Feels breaking but fixes incorrect behaviour so technically isn't 🤔

This change would certainly need to be prominent in the change-log!

Copy link
Member

@lobsterkatie lobsterkatie left a comment

Choose a reason for hiding this comment

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

Let's do it!

@lobsterkatie
Copy link
Member

P.S. I left some comments in #6041 about tests which by rights probably should be in this PR. I'll leave it up to you where to put them, but we should definitely test the new behavior somewhere.

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.

Gonna merge this in so we can release it - but will add a changelog note about it

@AbhiPrasad AbhiPrasad merged commit b2948e8 into getsentry:master Oct 27, 2022
Lms24 pushed a commit that referenced this pull request Oct 28, 2022
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 patch 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 for `shouldCreateSpanForRequest` and `shouldAttachHeaders`. 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 the `it.each()`
- `it('does not create span if there is no fetch data in handler data')` -> added header check, became `it('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')` and `it('does not add fetch request headers if tracing is disabled` -> combined into `it('adds neither fetch request spans nor fetch request headers if tracing is disabled')`
- `it('adds sentry-trace header to fetch requests')` -> absorbed into the `it.each()`
- Similar changes made to XHR tests

Co-authored-by: Tim Fish <tim@timfish.uk>
@timfish timfish deleted the fix/ignore-tracingOrigins-when-creating-spans branch November 29, 2022 09:36
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

4 participants