Skip to content

fix: Do not overwrite baggage header contents if it already exists#2896

Open
jakubsomonday wants to merge 1 commit intogetsentry:masterfrom
jakubsomonday:jakubso/fix-baggage-overwrite/1
Open

fix: Do not overwrite baggage header contents if it already exists#2896
jakubsomonday wants to merge 1 commit intogetsentry:masterfrom
jakubsomonday:jakubso/fix-baggage-overwrite/1

Conversation

@jakubsomonday
Copy link

When making outgoing HTTP requests, the SDK was overwriting any pre-existing baggage header on the request with Sentry's own baggage values. This caused loss of third-party baggage entries (e.g., routingKey, tenantId) that were already set on the request.

This fix updates set_propagation_headers to merge Sentry's baggage with any existing baggage on the request instead of replacing it, following the W3C Baggage specification which allows comma-separated list entries from multiple providers.

A similar issue was previously identified and fixed in the Python SDK: getsentry/sentry-python#2191

Changes

  • Modified Sentry::Utils::HttpTracing#set_propagation_headers to check for an existing baggage header and merge values instead of overwriting
  • Added test cases covering both the merge scenario and the default (no pre-existing baggage) scenario

Fixes #2894

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

set_propagation_headers overwrites existing baggage header instead of merging

1 participant