fix(js-sdk): Move tracePropagationTargets to top level config - #51900
Merged
Conversation
Contributor
Author
|
Validated this in |
k-fish
approved these changes
Jun 29, 2023
JonasBa
approved these changes
Jun 29, 2023
AbhiPrasad
enabled auto-merge (squash)
June 29, 2023 19:01
AbhiPrasad
added a commit
that referenced
this pull request
Jun 29, 2023
) This is a regression test to confirm that #51900 fixed inc-433. See https://getsentry.atlassian.net/browse/INC-433 for more details about the incident. It's purposefully a bare bones test - there's too many side effects with the sentry lib to unit test properly, so I opted for a very specific test that examines if we are setting `tracePropagationTargets` correctly - as messing this up ruins our backend observability.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 #51797 we bumped the JS SDK to
7.57.0. Changelog here: https://github.com/getsentry/sentry-javascript/releases/tag/7.57.0Notable in this release was adding the ability to set
tracePropagationTargetsas a top level option toSentry.init. PreviouslytracePropagationTargetswas a nested option inside theBrowserTracingintegration.This change is done in a backwards compat manner though, so that if you defined
tracePropagationTargetsinBrowserTracing, it is considered valid. What's notable is that we made the decision to say that defining a top leveltracePropagationTargets(inSentry.init) would override thetracePropagationTargetsset inBrowserTracingoptions - this minimized the bundle size of the backwards compat change.Unfortunately, our sdk init code in the sentry frontend was unintentionally setting
tracePropagationTargetsin the top level, via the spread operator.Previously this did nothing, but with the bump to
7.57.0, we started to use this top leveltracePropagationTargetsinstead of the one inBrowserTracing. This means we removed the/^\//target in['localhost', /^\//, ...extraTracePropagationTargets], which meant we stopped attaching headers to our outgoing api requests.This PR fixes this predicament by removing the usage of
BrowserTracingtracePropagationTargetsin favour of using the top level option.