Repository navigation
Conversation
This comment has been minimized.
This comment has been minimized.
This was referenced Oct 23, 2026
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. |
This was referenced Oct 23, 2026
TraceCollector, already one object per local trace, now implements TraceSegment and RequestContext. Request-scoped product data (AppSec, IAST, CI Visibility), the block response function and client IP data move off DDSpanContext onto it, so spans no longer each carry a copy and child spans no longer copy them from their parent. TraceSegment drops its span-relative *Current methods, which had no callers outside DDSpanContext's own implementation. Request context data set through the span builder now applies to the local trace. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The buffer writes out a trace untouched for 500ms, so the second dump only saw its traces if it ran sooner. Every other registered flare reporter runs first, which in a full test run took it past that. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dougqh
force-pushed
the
dougqh/collector-trace-segment
branch
from
November 12, 2026 01:53
2277afb to
c3b3bfb
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
Makes
TraceCollector, which already exists once per local trace, implementTraceSegmentandRequestContext. Trace-level state moves offDDSpanContextonto it:The
TraceSegment"top" operations now act on the collector's local root span.TraceSegmentalso loses its span-relative*Currentmethods. Nothing called them exceptDDSpanContext, which used them to implement the "top" methods.Motivation
This is the first step of the TraceSegment work (APMLP-2049): give per-trace state a per-trace home. Until now, each span either carried its own copy of the trace's request data or reached the root through
getRootSpanContextOrThis(). Child spans also no longer copy the parent's request data, which skips threegetDatacalls per child.Shallow sizes from JOL
ClassLayout.instanceSize(), JDK 17, compressed oops:DDSpanContext(per span)PendingTrace(per trace)StreamingTraceCollector(per trace)Net per trace: 24 − 16·N bytes for N spans. A single-span trace grows by 8 B; a 20-span trace shrinks by 296 B. This is independent of #13000.
Benchmarks
TraceShapeBenchmark. Basea7194ed640(merge base) vs headc3b3bfb00e. Temurin 17, 3 forks, 8 threads, dense store off. Run on a Bits worker: 5 vCPUs with 38% steal, so treat timings as noisy. B/op is unaffected.Allocation (B/op, head − base). This matches the predicted 24 − 16·N, with an extra ~16–24 B saved per trace:
legacynormalnewApiTime (ops/µs, head vs base):
legacynormalnewApilegacyandnormalare neutral at every size: every delta is within ±2% and the error bars overlap.newApiis from a rerun with 6 forks per side, alternated one fork at a time. The first run showed −10.2% at ch=1 and −7.1% at ch=5, but some forks sat in a low mode. In the rerun no fork on either side is in that mode, and head is neutral to slightly faster at every size, within the error bars. So the first run's slowdown was a scheduling or JIT mode, not a regression.newApihead fork at ch=20 got none of the B/op saving (forks: 22040 / 22360 / 22040). In the rerun all six head forks got it (22,368 → 22,040, −328).Additional Notes
withRequestContextDatais now trace-level. Data set throughSpanBuilder.withRequestContextDataapplies to the local trace. On a span that joins an existing local trace, it only fills a slot that trace hasn't set. The only production caller is CI Visibility'sTestImpl, which always starts a new local trace, so its behavior is unchanged. The Javadoc andCoreSpanBuilderTestare updated to match.getOrCreateMetaStructTopreturns null. That window only exists while the root span's own context is being constructed, and none of thegetTraceSegment()orgetRequestContext()callers run then.PropagationTags, origin, and sampling) stays where it is. It moves in a follow-up.Tests:
dd-trace-core(4818 tests),dd-trace-api,dd-trace-ot, AppSec, theinternal-apigateway tests, and theinstrumentation-testingcompile were run locally on JDK 17. Threedd-trace-coretests failed, none related to this change:TracerConnectionReliabilityTest(2 tests) needs Docker.PendingTraceBufferTest.testingTracerFlareDumpWithMultipleTracesfailed in the full-suite runs but passes when run on its own. It looks order-dependent.🤖 Generated with Claude Code