Skip to content

Parse Datadog ids and sampling priority from transient views - #13619

Draft
dougqh wants to merge 3 commits into
dougqh/transient-valuesfrom
dougqh/datadog-id-views
Draft

dougqh wants to merge 3 commits into
dougqh/transient-valuesfrom
dougqh/datadog-id-views

Conversation

@dougqh

@dougqh dougqh commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

What Does This Do

The Datadog extractor parses x-datadog-trace-id, x-datadog-parent-id and x-datadog-sampling-priority straight from a transient view of the value (#13618) when a carrier hands one, instead of from a decoded String. Extracted contexts are unchanged. No carrier hands views yet (part 5, Kafka).

Stacked on #13618. Part 4 of the value-views series. Includes #13616's commit (Parse decimal numbers from a CharSequence range), cherry-picked because #13616 is based on master; it drops out on rebase once #13616 lands.

Additional Notes

  • DatadogContextInterpreter.acceptTransient: for its three parse-only headers, parses the view with LongStringUtils.parseUnsignedLong / parseInt over the range (Parse decimal numbers from a CharSequence range (header optimization) #13616), which give what DDTraceId.from / DDSpanId.from / Integer.parseInt give for the same chars. Errors invalidate the context as before.
  • Exactness fallbacks: a value the String path would treat differently is copied and takes that path: one with a comma (firstHeaderValue keeps the part before it), or a trace id whose text isn't canonical (leading + or zero), since DDTraceId keeps the text it parsed and could print it back.
  • ExtractionCache's span id check parses the value as handed (view or String) with the same range parser.
  • No needless copies: a parse-only header is parsed by the style that owns it. The other styles' interpreters only need its value if the configuration names it (a request header tag, a baggage mapping, the client IP header), so ContextInterpreter.acceptTransient skips it without copying otherwise; the inferred proxy propagator reads only keys without a header constant from an indexed carrier. Without this, every interpreter in a compound extraction made its own copy of each view, which allocated more than decoding once.
  • Retention: the view is parsed within the call; nothing keeps it. The error log copies it.
  • Tests (ExtractorKeysForkedTest): for the Datadog extractor and the compound Datadog + W3C extractor, edge values (leading zeros, +, commas, junk, 0, unsigned and int limits, overflow) give the same context from views as from Strings; and overwriting every view after extraction leaves the context unchanged (nothing kept a view). With the earlier checks: 47 tests.

🤖 Generated with Claude Code

@dougqh dougqh added comp: core Tracer core tag: performance Performance related changes type: refactoring tag: ai generated Largely based on code generated by an AI or LLM labels Nov 21, 2026
@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
• Patch Coverage: 84.14%
• Overall Coverage: 59.68% (+0.03%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 76b5f3d | Docs | Give us feedback!

@dougqh
dougqh force-pushed the dougqh/datadog-id-views branch from 60b0a1f to 34e9eee Compare November 21, 2026 15:11
@dd-octo-sts

dd-octo-sts Bot commented Nov 21, 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.05 s 14.02 s [-0.4%; +0.9%] (no difference)
startup:insecure-bank:tracing:Agent 12.98 s 13.07 s [-1.2%; -0.1%] (maybe better)
startup:petclinic:appsec:Agent 17.16 s 16.55 s [-0.6%; +8.1%] (no difference)
startup:petclinic:iast:Agent 17.00 s 16.57 s [-1.7%; +6.9%] (no difference)
startup:petclinic:profiling:Agent 16.65 s 16.88 s [-2.3%; -0.4%] (maybe better)
startup:petclinic:sca:Agent 17.15 s 17.05 s [-0.4%; +1.6%] (no difference)
startup:petclinic:tracing:Agent 16.26 s 15.96 s [-2.7%; +6.5%] (no difference)

Commit: 76b5f3d3 · 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.

@pr-commenter

pr-commenter Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Kafka / producer-benchmark

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch dougqh/transient-values dougqh/datadog-id-views
git_commit_date 1795553623 1795553625
git_commit_sha 6e94b15 76b5f3d
See matching parameters
Baseline Candidate
ci_job_date 1795555018 1795555018
ci_job_id 2298334511 2298334511
ci_pipeline_id 156344335 156344335
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
jdkVersion 11.0.31 11.0.31
jmhVersion 1.36 1.36
jvm /usr/lib/jvm/java-11-openjdk-amd64/bin/java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
jvmArgs -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=15002 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=15002 -Dhttp.nonProxyHosts=localhost *.localhost
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-0-v7fwhg76 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-0-v7fwhg76 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
vmName OpenJDK 64-Bit Server VM OpenJDK 64-Bit Server VM
vmVersion 11.0.31+11-post-1ubuntu1-22.04.2-Ubuntu 11.0.31+11-post-1ubuntu1-22.04.2-Ubuntu

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 3 metrics, 0 unstable metrics.

See unchanged results
scenario Δ mean throughput
scenario:not-instrumented/KafkaProduceBenchmark.benchProduce same
scenario:only-tracing-dsm-disabled-benchmarks/KafkaProduceBenchmark.benchProduce same
scenario:only-tracing-dsm-enabled-benchmarks/KafkaProduceBenchmark.benchProduce same

@pr-commenter

pr-commenter Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Kafka / consumer-benchmark

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch dougqh/transient-values dougqh/datadog-id-views
git_commit_date 1795553623 1795553625
git_commit_sha 6e94b15 76b5f3d
See matching parameters
Baseline Candidate
ci_job_date 1795555065 1795555065
ci_job_id 2298334516 2298334516
ci_pipeline_id 156344335 156344335
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
jdkVersion 11.0.31 11.0.31
jmhVersion 1.36 1.36
jvm /usr/lib/jvm/java-11-openjdk-amd64/bin/java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
jvmArgs -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=15002 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=15002 -Dhttp.nonProxyHosts=localhost *.localhost
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-0-0xi3i2k2 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-0-0xi3i2k2 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
vmName OpenJDK 64-Bit Server VM OpenJDK 64-Bit Server VM
vmVersion 11.0.31+11-post-1ubuntu1-22.04.2-Ubuntu 11.0.31+11-post-1ubuntu1-22.04.2-Ubuntu

Summary

Found 1 performance improvements and 0 performance regressions! Performance is the same for 2 metrics, 0 unstable metrics.

scenario Δ mean throughput
scenario:not-instrumented/KafkaConsumerBenchmark.benchConsume better
[+3458.105op/s; +13663.253op/s] or [+1.181%; +4.665%]
See unchanged results
scenario Δ mean throughput
scenario:only-tracing-dsm-disabled-benchmarks/KafkaConsumerBenchmark.benchConsume same
scenario:only-tracing-dsm-enabled-benchmarks/KafkaConsumerBenchmark.benchConsume same

@dougqh
dougqh force-pushed the dougqh/transient-values branch from f476891 to 42b4292 Compare November 21, 2026 19:14
@dougqh
dougqh force-pushed the dougqh/datadog-id-views branch 2 times, most recently from 06bd242 to 11bb1c7 Compare November 21, 2026 19:39
@dougqh
dougqh force-pushed the dougqh/transient-values branch from 42b4292 to 14e69c0 Compare November 21, 2026 19:39
@dougqh
dougqh force-pushed the dougqh/datadog-id-views branch from 11bb1c7 to ba28504 Compare November 23, 2026 21:17
@dougqh
dougqh force-pushed the dougqh/transient-values branch 2 times, most recently from 91853e7 to 99a95b0 Compare November 23, 2026 23:36
@dougqh
dougqh force-pushed the dougqh/datadog-id-views branch from ba28504 to 0d337eb Compare November 23, 2026 23:36
@dougqh
dougqh force-pushed the dougqh/transient-values branch from 99a95b0 to 78e080c Compare November 23, 2026 23:47
@dougqh
dougqh force-pushed the dougqh/datadog-id-views branch from 0d337eb to 6bea93d Compare November 23, 2026 23:47
@dougqh
dougqh force-pushed the dougqh/transient-values branch from 78e080c to c482fd9 Compare November 24, 2026 02:33
@dougqh
dougqh force-pushed the dougqh/datadog-id-views branch 2 times, most recently from 76394da to fbcec63 Compare November 24, 2026 18:30
@dougqh
dougqh force-pushed the dougqh/transient-values branch from c482fd9 to 5772ee9 Compare November 24, 2026 18:30
@dougqh
dougqh force-pushed the dougqh/datadog-id-views branch from fbcec63 to c36aa26 Compare November 24, 2026 20:10
@dougqh
dougqh force-pushed the dougqh/transient-values branch from 5772ee9 to 8028571 Compare November 24, 2026 20:10
dougqh and others added 3 commits November 24, 2026 15:53
Adds parseUnsignedLong / parseLong / parseInt overloads to LongStringUtils
that take the range [start, end) of a CharSequence and give the same result,
or NumberFormatException, as their String counterparts on the same chars
(Java 8 has no range-based CharSequence overloads of Long.parseLong /
Integer.parseInt). They let a header value be parsed in place, from a view,
without making a String first. parseUnsignedLong(String) now shares its
19-20 digit path with the range overload.

LongStringUtilsRangeTest compares outcomes with the String parsers on edge
cases (signs, Unicode digits, every length boundary, overflow) and on
random input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Datadog interpreter overrides acceptTransient: the trace id, parent id
and sampling priority are parsed straight from the view with
LongStringUtils' range parsers, which give what the String path does for
the same chars. Values that path would treat differently (comma-separated
values, or a trace id whose text isn't canonical, since DDTraceId keeps the
text it parsed) are copied and take it. ExtractionCache's span id check
parses the value as handed too. Nothing keeps a view.

ExtractorKeysForkedTest checks edge values (leading zeros, '+', commas,
junk, unsigned / int limits) give the same context from views as from
Strings, and that overwriting the views after extraction changes nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A parse-only header is parsed by the style that owns it; the other styles'
interpreters only need its value if the configuration names it (a request
header tag, a baggage mapping, the client IP header), so ContextInterpreter
skips it without copying the view otherwise. The inferred proxy propagator
reads only keys without a header constant from an indexed carrier, since a
known header never has its prefix. Without these, every interpreter in a
compound extraction made its own copy of each view.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dougqh
dougqh force-pushed the dougqh/transient-values branch from 8028571 to 6e94b15 Compare November 24, 2026 21:00
@dougqh
dougqh force-pushed the dougqh/datadog-id-views branch from c36aa26 to 76b5f3d Compare November 24, 2026 21:00

This branch has not been deployed

No deployments
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 tag: performance Performance related changes type: refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant