GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Write the injecting span's id into tracestate without formatting a String by dougqh · Pull Request #13669 · DataDog/dd-trace-java

Conversation

@dougqh

@dougqh dougqh commented Nov 24, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

What Does This Do

Writes the injecting span's id into the W3C tracestate's p element straight from the long, instead of formatting it into a padded hex String first.

PaddedHexSpanId is a small CharSequence holding the id. W3CPTagsCodec.appendPrefix recognizes it and appends its 16 digits directly into the header it is building. The parent-id override is only ever measured (length()) and appended, so no API changes. The header is byte-identical: the compound extraction golden, which records every injected header, is unchanged.

Motivation

The W3C injector passed DDSpanId.toHexStringPadded(spanId), which costs a byte[] and a String per injection, only for the encoder to copy them into the header. In a JFR profile of a Kafka enricher this formatting was about 3% of inject time. It's a small item from the Kafka per-record cost work.

Results

InjectorBenchmark.injectContext (default inject styles, Datadog + W3C), 3 forks × 5 iterations:

base this PR
allocation 10,357 ± 45 B/op 10,220 ± 13 B/op (−137 B)

Quiet re-run (3 forks × 5 iterations): 17.31 ± 0.20 → 17.23 ± 0.16 µs/op (no change within error), allocation 10,348 → 10,214 B/op (−134 B). So it saves allocation without costing time.

Additional Notes

  • PaddedHexSpanIdTest checks charAt, appendTo, subSequence and toString against DDSpanId.toHexStringPadded for zero, one, a typical id, and the signed extremes.
  • Stacked on Read only the priority and parent id from a lower-priority W3C tracestate #13650, alongside Inject an unchanged trace's extracted x-datadog-tags as it arrived #13662 and Check an inherited ot member's consistency once, not on every write #13664. All three are independent.

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@dougqh @claude
Write the injecting span's id into tracestate without formatting a St…
3bf3c46
…ring

The W3C injector passed the span's id for the tracestate's p element as
DDSpanId.toHexStringPadded, a byte array and a String per injection that the
encoder then copied into the header. PaddedHexSpanId carries the id as a long
and the encoder appends its 16 digits directly. The header is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@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 24, 2026
@datadog-prod-us1-3

datadog-prod-us1-3 Bot commented Nov 24, 2026 •
edited by datadog-datadog-prod-us1-2 Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

🎯 Code Coverage (details)
• Patch Coverage: 94.12%
• Overall Coverage: 59.88% (+0.01%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 3bf3c46 | Docs | Give us feedback!
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dd-octo-sts

dd-octo-sts Bot commented Nov 24, 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.03 s 14.01 s [-0.4%; +0.8%] (no difference)
startup:insecure-bank:tracing:Agent 12.94 s 13.00 s [-1.2%; +0.3%] (no difference)
startup:petclinic:appsec:Agent 17.04 s 16.93 s [-0.2%; +1.6%] (no difference)
startup:petclinic:iast:Agent 16.99 s 17.07 s [-1.3%; +0.3%] (no difference)
startup:petclinic:profiling:Agent 16.03 s 16.17 s [-6.8%; +5.0%] (unstable)
startup:petclinic:sca:Agent 17.08 s 16.98 s [-0.2%; +1.5%] (no difference)
startup:petclinic:tracing:Agent 16.21 s 16.22 s [-0.9%; +0.7%] (no difference)

Commit: 3bf3c469 · 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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

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

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@dougqh
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.