Skip to content

Simplify TID header parsing error handling - #12927

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
masterfrom
bbujon/dd-tid-headers
Oct 19, 2026
Merged

gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
masterfrom
bbujon/dd-tid-headers

Conversation

@PerfectSlayer

@PerfectSlayer PerfectSlayer commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

What Does This Do

This PR simplifies #12739 (not yet released) while keeping its goal: malformed x-datadog-trace-id / x-datadog-parent-id headers no longer produce telemetry log events.

Motivation

#12739 cut the telemetry events (and Error Tracking volume) caused by malformed Datadog id headers, but it did so by:

  • adding a public, "internal only" method to DD64bTraceId that nothing stops users from calling, and that DD128bTraceId and DDSpanId don't have;
  • adding a second decimal parser next to the existing one;
  • having the header decoding call these internal methods instead of the usual from methods.

The telemetry cost comes from logging the exception, not from throwing it. Handling NumberFormatException separately in the existing catch block is enough to remove it.

Additional Notes

  • Trade-off: a malformed id still costs a thrown exception per request. Parse Datadog trace and span id headers without exceptions #12739's benchmark measured about 840-880 ns for an invalid id, against 21-43 ns without the exception, and about 40 ns more per extraction for valid ids. We accept that cost for invalid input coming from the network, in exchange for a smaller API and less code.
  • Wider exclusion: the new catch also covers a malformed x-datadog-sampling-priority (Integer.parseInt). That is caller input too, so it is also kept out of telemetry.

Contributor Checklist

🤖 Generated with Claude Code

@PerfectSlayer PerfectSlayer added this to the 1.68.0 milestone Oct 19, 2026
@PerfectSlayer PerfectSlayer added comp: core Tracer core tag: no release notes Changes to exclude from release notes type: refactoring tag: ai generated Largely based on code generated by an AI or LLM labels Oct 19, 2026
Revert the non-throwing id parsing from #12739: DD64bTraceId.fromOrNull and
the LongStringUtils sentinel parser added public API, duplicated the decimal
parser, and diverged from DD128bTraceId and DDSpanId.

Keep the goal of keeping malformed headers out of telemetry by catching
NumberFormatException during Datadog context extraction and logging it with
EXCLUDE_TELEMETRY, without the stack trace.
@datadog-datadog-prod-us1-2

This comment has been minimized.

@dd-octo-sts

dd-octo-sts Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.01 s 13.91 s [-0.2%; +1.5%] (no difference)
startup:insecure-bank:tracing:Agent 12.77 s 12.97 s [-2.4%; -0.7%] (maybe better)
startup:petclinic:appsec:Agent 17.05 s 16.85 s [+0.4%; +2.0%] (maybe worse)
startup:petclinic:iast:Agent 16.78 s 17.02 s [-2.2%; -0.6%] (maybe better)
startup:petclinic:profiling:Agent 16.76 s 16.70 s [-0.8%; +1.5%] (no difference)
startup:petclinic:sca:Agent 17.03 s 16.82 s [+0.4%; +2.1%] (maybe worse)
startup:petclinic:tracing:Agent 16.02 s 16.17 s [-1.7%; -0.1%] (maybe better)

Commit: adc82087 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

@PerfectSlayer PerfectSlayer changed the title Simplify Datadog id header parsing error handling Simplify TID header parsing error handling Oct 19, 2026
@PerfectSlayer
PerfectSlayer marked this pull request as ready for review October 19, 2026 11:08
@PerfectSlayer
PerfectSlayer requested review from a team as code owners October 19, 2026 11:08
@PerfectSlayer
PerfectSlayer requested review from cecile75 and removed request for a team October 19, 2026 11:08
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T11:12:37.947313Z 86e545d Draft marked ready
🔒 Security Review ✅ Completed 2026-10-19T11:15:36.515241Z 86e545d Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 86e545dd2b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: FAIL

Some out-of-range 20-digit trace and parent IDs are now accepted as wrapped 64-bit values, bypassing malformed-context rejection.

Open Bits AI session

🤖 Bits Code Review · Commit 86e545d

@mcculls mcculls left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This simplification makes sense to me

@PerfectSlayer PerfectSlayer added type: bug fix Bug fix and removed tag: no release notes Changes to exclude from release notes type: refactoring labels Oct 19, 2026
@PerfectSlayer

Copy link
Copy Markdown
Collaborator Author

Applied feedback and relabeled as bug fix due to the agentic review increasing the scope of the PR

@PerfectSlayer
PerfectSlayer added this pull request to stack #12930 October 19, 2026 12:41
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 4854ea1 into master Oct 19, 2026
613 of 616 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the bbujon/dd-tid-headers branch October 19, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: core Tracer core tag: ai generated Largely based on code generated by an AI or LLM type: refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants