Skip to content

Commit aff06e0

Browse files
authored
chore(utils): Update parseBaggageSetMutability docstring (#5657)
1 parent 51c016f commit aff06e0

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

packages/utils/src/baggage.ts

+8-9
Original file line numberDiff line numberDiff line change
@@ -163,16 +163,15 @@ export function mergeAndSerializeBaggage(incomingBaggage?: Baggage, thirdPartyBa
163163
}
164164

165165
/**
166-
* Helper function that takes a raw baggage string (if available) and the processed sentry-trace header
167-
* data (if available), parses the baggage string and creates a Baggage object
168-
* If there is no baggage string, it will create an empty Baggage object.
169-
* In a second step, this functions determines if the created Baggage object should be set immutable
170-
* to prevent mutation of the Sentry data.
166+
* Helper function that takes a raw baggage value (if available) and the processed sentry-trace header
167+
* data (if available), parses the baggage value and creates a Baggage object. If there is no baggage
168+
* value, it will create an empty Baggage object.
171169
*
172-
* Extracted this logic to a function because it's duplicated in a lot of places.
170+
* In a second step, this functions determines if the created Baggage object should be set immutable
171+
* to prevent mutation of the Sentry data. It does this by looking at the processed sentry-trace header.
173172
*
174-
* @param rawBaggageValue
175-
* @param sentryTraceHeader
173+
* @param rawBaggageValue baggage value from header
174+
* @param sentryTraceHeader processed Sentry trace header returned from `extractTraceparentData`
176175
*/
177176
export function parseBaggageSetMutability(
178177
rawBaggageValue: HttpHeaderValue | false | undefined,
@@ -187,7 +186,7 @@ export function parseBaggageSetMutability(
187186
// this SDK is the head of the trace and thus we still permit mutation at this time.
188187
// There is one exception though, which is that we get a baggage-header with `sentry-`
189188
// items but NO sentry-trace header. In this case we also set the baggage immutable for now
190-
// but if smoething like this would ever happen, we should revisit this and determine
189+
// but if something like this would ever happen, we should revisit this and determine
191190
// what this would actually mean for the trace (i.e. is this SDK the head?, what happened
192191
// before that we don't have a sentry-trace header?, etc)
193192
(sentryTraceHeader || !isSentryBaggageEmpty(baggage)) && setBaggageImmutable(baggage);

0 commit comments

Comments
 (0)