From d7417b578335145e21686825769fb1bae25d12dc Mon Sep 17 00:00:00 2001 From: Munir Abdinur Date: Mon, 26 Aug 2024 10:15:46 -0700 Subject: [PATCH] chore(w3c): avoid setting _dd.parent_id to 16 zeros (#4576) --- packages/dd-trace/src/opentracing/propagation/text_map.js | 7 +------ .../dd-trace/test/opentracing/propagation/text_map.spec.js | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/dd-trace/src/opentracing/propagation/text_map.js b/packages/dd-trace/src/opentracing/propagation/text_map.js index 346e5e0091..1346f85de7 100644 --- a/packages/dd-trace/src/opentracing/propagation/text_map.js +++ b/packages/dd-trace/src/opentracing/propagation/text_map.js @@ -236,8 +236,7 @@ class TextMapPropagator { } _hasParentIdInTags (spanContext) { - return tags.DD_PARENT_ID in spanContext._trace.tags && - spanContext._trace.tags[tags.DD_PARENT_ID] !== zeroTraceId + return tags.DD_PARENT_ID in spanContext._trace.tags } _updateParentIdFromDdHeaders (carrier, firstSpanContext) { @@ -445,10 +444,6 @@ class TextMapPropagator { } }) - if (!spanContext._trace.tags[tags.DD_PARENT_ID]) { - spanContext._trace.tags[tags.DD_PARENT_ID] = zeroTraceId - } - this._extractBaggageItems(carrier, spanContext) return spanContext } diff --git a/packages/dd-trace/test/opentracing/propagation/text_map.spec.js b/packages/dd-trace/test/opentracing/propagation/text_map.spec.js index e6a206a8bb..58ee69047b 100644 --- a/packages/dd-trace/test/opentracing/propagation/text_map.spec.js +++ b/packages/dd-trace/test/opentracing/propagation/text_map.spec.js @@ -521,7 +521,7 @@ describe('TextMapPropagator', () => { const carrier = textMap const spanContext = propagator.extract(carrier) - expect(spanContext._trace.tags).to.have.property('_dd.parent_id', '0000000000000000') + expect(spanContext._trace.tags).to.not.have.property('_dd.parent_id') }) it('should not extract tracestate from tracecontext when trace IDs don\'t match', () => {