|
1 | 1 | /* eslint-disable max-lines */ |
2 | | -import { Baggage } from '@sentry/types'; |
3 | 2 | import { |
4 | 3 | addInstrumentationHandler, |
5 | 4 | BAGGAGE_HEADER_NAME, |
6 | | - createBaggage, |
7 | | - getThirdPartyBaggage, |
8 | 5 | isInstanceOf, |
9 | 6 | isMatchingPattern, |
10 | | - parseBaggageString, |
11 | | - serializeBaggage, |
| 7 | + mergeAndSerializeBaggage, |
12 | 8 | } from '@sentry/utils'; |
13 | 9 |
|
14 | 10 | import { Span } from '../span'; |
@@ -314,30 +310,3 @@ export function xhrCallback( |
314 | 310 | } |
315 | 311 | } |
316 | 312 | } |
317 | | - |
318 | | -/** |
319 | | - * Merges the baggage header we saved from the incoming request (or meta tag) with |
320 | | - * a possibly created or modified baggage header by a third party that's been added |
321 | | - * to the outgoing request header. |
322 | | - * |
323 | | - * In case @param headerBaggage exists, we can safely add the the 3rd party part of @param headerBaggage |
324 | | - * with our @param incomingBaggage. This is possible because if we modified anything beforehand, |
325 | | - * it would only affect parts of the sentry baggage (@see Baggage interface). |
326 | | - * |
327 | | - * @param incomingBaggage the baggage header of the incoming request that might contain sentry entries |
328 | | - * @param headerBaggageString possibly existing baggage header string added from a third party to request headers |
329 | | - * |
330 | | - * @return a merged and serialized baggage string to be propagated with the outgoing request |
331 | | - */ |
332 | | -function mergeAndSerializeBaggage(incomingBaggage?: Baggage, headerBaggageString?: string): string { |
333 | | - if (!incomingBaggage && !headerBaggageString) { |
334 | | - return ''; |
335 | | - } |
336 | | - |
337 | | - const headerBaggage = (headerBaggageString && parseBaggageString(headerBaggageString)) || undefined; |
338 | | - const thirdPartyHeaderBaggage = headerBaggage && getThirdPartyBaggage(headerBaggage); |
339 | | - |
340 | | - const finalBaggage = createBaggage((incomingBaggage && incomingBaggage[0]) || {}, thirdPartyHeaderBaggage || ''); |
341 | | - |
342 | | - return serializeBaggage(finalBaggage); |
343 | | -} |
0 commit comments