Repository navigation
Conversation
Contributor
Contributor
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
A malformed traceparent made parseTraceParent throw IllegalStateException or NumberFormatException, caught in build() and buildForMerge(): an exception per request, and the largest source of instrumentation telemetry errors on 1.68 (about 6.2M events from 190 orgs in 7 days). parseTraceParent and parseRequiredTraceParent now return whether the header is valid, and parse hex parts with parseUnsignedLongHexOrZero. The low half of the trace id and the span id may not be zero, so a zero result rejects them as before; the version, the trace id's high half and the flags may be zero, so for those a zero result is rejected only when the characters aren't all zeros. A rejection logs its reason at debug level, without an exception. Extraction results are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dougqh
force-pushed
the
dougqh/w3c-traceparent-no-throw
branch
from
November 12, 2026 01:53
917d347 to
e779675
Compare
dougqh
force-pushed
the
dougqh/lazy-extracted-id-hex
branch
from
November 12, 2026 01:53
638fc32 to
aaa10fe
Compare
This branch has not been deployed
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.
What Does This Do
Rejects a malformed W3C
traceparentheader without throwing an exception. Extraction results are unchanged.parseTraceParentandparseRequiredTraceParentnow return whether the header is valid, instead of throwingIllegalStateException(length, version, zero IDs, separator) orNumberFormatException(non-hex characters).LongStringUtils.parseUnsignedLongHexOrZero, which returns0instead of throwing:0.build()still falls back toonlyTagContext()andbuildForMerge()still returnsnull. The tracestate parsing keeps its own try/catch.Motivation
On 1.68, the catch in
build()("Exception when building context") was the single largest source of instrumentation telemetry errors: about 6.2M events from 190 orgs in 7 days. That's 4.9MIllegalStateExceptionevents fromparseTraceParentHeader, plus 1.3MNumberFormatExceptionevents fromLongStringUtils. These are headers callers send malformed, not tracer failures. Each one also cost an exception, with a stack trace and a string-concatenated message, on the request path.Testing
W3CHttpExtractorTest.extractTraceparentalready pins the extraction result for each malformed form (length, version, uppercase and non-ASCII characters in the trace and span IDs, zero IDs, separators). I added rows for the zero-check paths that weren't covered: a non-hex or uppercase version, and non-hex or uppercase flags.malformedTraceparentIsRejectedWithoutAnException. For five malformed forms, no context is extracted, a debug "Ignoring invalid traceparent" is logged, and no exception is logged.W3CHttpCodec: the 5 new no-exception cases fail and the other 1,414 propagation tests pass, including everyextractTraceparentrow, old and new, andCompoundExtractionGoldenTestfor the merge path. That's the evidence the extraction behavior is unchanged.datadog.trace.core.propagation.*andLongStringUtilsTestpass, and:dd-trace-core:spotbugsMainis clean.Additional Notes
parseUnsignedLongHexOrZeroand its test from Reject malformed B3 span ids without exceptions (quick fix) #13355, which targets master. Drop that commit when rebasing onto a master that contains Reject malformed B3 span ids without exceptions (quick fix) #13355.RuntimeExceptions inbuild()still go through the existing catch.🤖 Generated with Claude Code