Reproduce RUMS-3855: invalid W3C traceparent parentId decimal encoding#3360
Closed
Reproduce RUMS-3855: invalid W3C traceparent parentId decimal encoding#3360
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reproduction for RUMS-3855
Jira: RUMS-3855
Issue Summary
TracingInterceptor generates invalid W3C traceparent headers when a span is not sampled: it converts spanId via Long.toString() (decimal) instead of hex encoding, producing a parentId field that may exceed 16 characters. This causes "Invalid traceparent version" errors on the backend.
Reproduction Tests
Failing tests demonstrating the bug in TracingInterceptor.
What the Tests Prove
The parentId field in the generated traceparent header contains decimal digits and is not properly bounded to 16 hex characters, violating the W3C Trace Context specification.
Root Cause Analysis
TracingInterceptor.handleW3CNotSampledHeaders() calls span.context().toSpanId() which returns a decimal representation of the Long spanId (up to 20 chars) instead of the required 16-char hex string.
Call Chain
TracingInterceptor.interceptAndTrace()
→ TracingInterceptor.updateRequest() [isSampled=false branch]
→ TracingInterceptor.setSampledOutHeaders()
→ TracingInterceptor.handleW3CNotSampledHeaders(span, requestBuilder)
→ span.context().toSpanId() [returns DECIMAL, not hex]
→ W3C_TRACEPARENT_DROP_SAMPLING_DECISION.format(traceId, spanId.padStart(16, '0'))
→ addHeader('traceparent', '00-{32hex}-{decimalSpanId}-00') [>55 chars when spanId >16 decimal digits]
→ Backend: ValueError: Invalid traceparent version
Failure Output
Test 1:
traceparent must be exactly 55 chars per W3C spec— actual header '00-{32hex}-9223372036854775807-00' is 58 chars (expected 55).Test 2:
traceparent must match W3C pattern '00-[0-9a-f]{32}-[0-9a-f]{16}-0[01]'— parentId '9223372036854775807' is 19 decimal digits, not 16 hex chars.Generated by rum:tee-triage-insights