Skip to content

Commit 60b978a

Browse files
committed
more cleanup
1 parent 7b75918 commit 60b978a

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

packages/node-core/src/utils/outgoingFetchRequest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function stringToArrayHeaders(requestHeaders: string): string[] {
9797
}
9898
const key = header.slice(0, colonIndex).trim();
9999
const value = header.slice(colonIndex + 1).trim();
100-
if (key != null && value != null) {
100+
if (key && value) {
101101
headers.push(key, value);
102102
}
103103
} catch {}

packages/node-core/src/utils/outgoingHttpRequest.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ export function addTracePropagationHeadersToOutgoingRequest(
112112
cleanedExistingBaggage = objectToBaggageHeader(baggageWithoutSentry);
113113
}
114114

115-
// If a sentry-trace header was already added, we don't add our baggage at all.
116115
const newBaggage = mergeBaggageHeaders(cleanedExistingBaggage, baggage);
117116
if (newBaggage) {
118117
try {

packages/opentelemetry/src/propagator.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ export class SentryPropagator extends W3CBaggagePropagator {
7575
if (baggageEntries) {
7676
Object.entries(baggageEntries).forEach(([key, value]) => {
7777
if (!existingSentryTraceHeader && key.startsWith(SENTRY_BAGGAGE_KEY_PREFIX)) {
78+
// Edge case: A baggage header with sentry- keys was added previously but no
79+
// sentry-trace header. In this case we remove the old sentry-keys and add new
80+
// ones below.
7881
return;
7982
}
8083
baggage = baggage.setEntry(key, { value });

0 commit comments

Comments
 (0)