Wire mergedTracerTags as a read-through parent at span build (level-split phase 1)#11932
Draft
dougqh wants to merge 4 commits into
Draft
Wire mergedTracerTags as a read-through parent at span build (level-split phase 1)#11932dougqh wants to merge 4 commits into
dougqh wants to merge 4 commits into
Conversation
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. |
02ef063 to
7bb20f4
Compare
Version is conditionally managed by InternalTagsAdder (added only when service == DD_SERVICE and not set during the request). It was being applied to every span via the trace-level bundle, then immediately stripped by a per-span removeTag(VERSION) — apply-then-remove, net zero. Exclude it from the bundle once at config build (withTracerTags) instead. This is behavior-preserving today, and it prepares the bundle to become a read-through parent: a removeTag on a key that lived in the parent would mint a per-span tombstone. With version excluded, the retained per-span removeTag(VERSION) (which still wipes a builder-set version, preserving the existing semantics) is a cheap local op, never a tombstone. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Level-split phase 1: when the trace-level bundle has no interceptable tags (!mergedTracerTagsNeedsIntercept), attach it as a read-through parent of the span's tags (shared by reference) instead of copying its entries into every span. When it does need interception, fall back to the copy path (the interceptor's per-span side-effects can't be shared). - TagMap.withParent promoted to the interface (was package-private on OptimizedTagMap) — the public wiring deferred from the mechanism change. - DDSpanContext.parentTags attaches the (frozen) parent to unsafeTags. - CoreTracer span-build gates copy-vs-share on needsIntercept. mergedTracerTags is the precedence floor (overridden by all other contributors), so attaching it as the lowest-precedence parent preserves ordering. Version was already excluded from the bundle, so the per-span removeTag never tombstones. Tag-touching tests (CoreSpanBuilder/CoreTracer/DDSpan/InternalTagsAdder) green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Models span-build tag assembly: copyDown (putAll the frozen trace-level bundle
into a fresh span map, then span tags) vs readThrough (attach the bundle as a
read-through parent, span tags local only). Run with -prof gc to isolate the
per-span allocation read-through saves. Swept by traceTagCount {3,7,15} so the
win can be seen scaling with the bundle size; 7 ~ a realistic mergedTracerTags.
Quick read (noisy box): readThrough ~38% less alloc (deterministic) and ~1.7x
throughput. The alloc delta is bucket structure (BucketGroup clones + fewer local
collisions), not Entry objects -- putAll-into-empty already shares frozen entries.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Rework the wiring onto the footgun-free API: instead of the post-construction DDSpanContext.parentTags()/withParent() seam, thread a nullable read-through parent into the DDSpanContext constructor and build unsafeTags via TagMap.createFromParent(parent) when present. CoreTracer passes mergedTracerTags on the !needsIntercept path (null otherwise), so the parent is fixed at construction and read-through relies on a guarantee, not an unenforced convention. Removes parentTags(); a back-compat 24-arg ctor delegates with a null parent so existing callers are unaffected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
7bb20f4 to
e65e58f
Compare
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.
Stacked on #11789 (TagMap read-through mechanism) — review that first.
Level-split phase 1: the wiring. Attaches
mergedTracerTagsas a read-through parent at span build (gated on!mergedTracerTagsNeedsIntercept) instead of copying it into every span's storage. This is the change that actually activates read-through — #11789 alone is inert (parent == null).Commits: config-version handling out of the trace-level bundle, the read-through flip (
DDSpanContext.parentTags/CoreTracercopy-vs-share gate), and aTagMapReadThroughBenchmark.Draft — description to be refined; posting now so review can start this week ahead of the release cut.
🤖 Generated with Claude Code