You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ref: Make dynamic sampling context mutable (#5710)
This PR makes Dynamic Sampling Context in Head-SDKs mutable.
List of changes:
- Remove our `Baggage` abstraction (keeping track of foreign baggage and mutability is not necessary)
- Replace `Baggage` abstraction with functions that convert `baggage` headers into DSC and vice-versa
- Replace `getBaggage()` method on the `Transaction` class with `getDynamicSamplingContext()` which doesn't freeze DSC upon retrieval
- Refactor the adding of Sentry `baggage` items so that we're (almost) always adding an additional independent `baggage` header, in addition to any that were already there. This was done to reduce code complexity and bundle size. An exception here is in the browser where there is a case where I don't know if adding an additional header might break things.
- Explicitly handle the case of multiple incoming baggage headers. (if there are multiple items that are named the same, last one always wins)
- Freeze DSC in the transaction creation if DSC was provided via `transactionContext.metadata.dynamicSamplingContext` - used in non-head-SDKs
- Fix `extractTraceparentData` so that it returns `undefined` (ie. "invalid") when passed an empty string - also added a test for that.
0 commit comments