Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove ability to propagate baggage on its own to avoid app crashes #5209

Merged
merged 7 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/dd-trace/src/opentracing/propagation/text_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,9 @@ class TextMapPropagator {
if (context === null) {
context = extractedContext
if (this._config.tracePropagationExtractFirst) {
if (this._hasPropagationStyle('extract', 'baggage') && carrier.baggage) {
this._extractBaggageItems(carrier, context)
}
return context
}
} else {
Expand All @@ -345,7 +348,6 @@ class TextMapPropagator {
}

if (this._hasPropagationStyle('extract', 'baggage') && carrier.baggage) {
context = context || new DatadogSpanContext()
this._extractBaggageItems(carrier, context)
}

Expand Down Expand Up @@ -596,6 +598,7 @@ class TextMapPropagator {
}

_extractBaggageItems (carrier, spanContext) {
if (!carrier) return
const baggages = carrier.baggage.split(',')
for (const keyValue of baggages) {
if (!keyValue.includes('=')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,8 @@ describe('TextMapPropagator', () => {
expect(spanContextD._baggageItems).to.deep.equal({})
})

it('should extract baggage when it is the only propagation style', () => {
// temporary test. On the contrary, it SHOULD extract baggage
it('should not extract baggage when it is the only propagation style', () => {
config = new Config({
tracePropagationStyle: {
extract: ['baggage']
Expand All @@ -462,7 +463,7 @@ describe('TextMapPropagator', () => {
baggage: 'foo=bar'
}
const spanContext = propagator.extract(carrier)
expect(spanContext._baggageItems).to.deep.equal({ foo: 'bar' })
expect(spanContext).to.be.null
})

it('should convert signed IDs to unsigned', () => {
Expand Down
Loading