Generate KnownTags from a tag-conventions registry#11961
Draft
dougqh wants to merge 1 commit into
Draft
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. |
6a83a99 to
fdf3c4a
Compare
267ebad to
56550cb
Compare
|
🎯 Code Coverage (details) 🔗 Commit SHA: ad3c1f7 | Docs | Datadog PR Page | Give us feedback! |
Replace the hand-written KnownTags with a build-time code generator: a language-agnostic tag-conventions.yaml (span types via extends/include/applies) + a Java overlay (tag-conventions.java.yaml: intercepted hints + the virtual registry) drive a buildSrc generator that emits KnownTags.java (id constants + keyOf/nameOf resolver) to committed src/generated. A verifyKnownTags check regenerates and byte-compares to catch stale commits; src/generated is excluded from spotless (the emitter produces google-java-format-clean output). - buildSrc: TagRegistryGeneratorPlugin + generate/verify tasks + parse/resolve (TagConventions) + id-assignment/coloring (TagRegistry) + emit (KnownTagsEmitter). - KnownTagCodec gains the name-free 3-arg tagId(globalSerial, intercepted, slot) the generator uses. - Generated per-type layout reports (resolved/tag-assignment/layout-by-type/ folded-types) committed as auditable artifacts — the per-type counts are the substrate the (follow-on) per-type dense-array sizing reads. Substrate only: this lands the generated ids/resolver + the codegen source of truth; it does NOT yet change dense-array sizing (that per-type-sizing step is the follow-on that climbs out of the alloc valley). Reconciled onto the dense + bloom stack; generated ids cohere with the dense store (forked/fuzz green). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fdf3c4a to
ad3c1f7
Compare
dougqh
added a commit
that referenced
this pull request
Jul 15, 2026
set(long id, Object value) is the id-keyed insertion path: the caller passes a resolved KnownTags id, so it skips the keyOf name resolution the set(String, ...) methods pay and stores densely. The id must be a stored known-tag id; custom names have no id and use the name-keyed setters. The name is resolved lazily only to clear a read-through tombstone (rare). Adds TagMapInsertionComparisonBenchmark (dense vs HashMap insertion, -prof gc) — the isolated micro where the dense store + bloom insertion win shows, and the home for the id-keyed vs string-keyed comparison. Reconciled onto the tag registry (#11961). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Code-generates the
KnownTagsregistry from a language-agnostictag-conventions.yaml(+ a Javaoverlay), replacing the hand-maintained version. Based on
dougqh/tag-id-api(the dense-storebranch). Draft — the generator works end to end (main compiles, tests pass); the committed-output
wiring is the remaining piece.
From Claude:
Pipeline (
buildSrctaskdd-trace-java.tag-registry-generator): parse → resolve per-type tag sets(
extends/include/applies) → assign ids → assign slots by deterministic graph coloring overper-type layers + an explicit
trace_levellayer → emitKnownTags.java.serial | slot | intercepted(no name hash — known ids are dense-store addressed;the name hash is the custom/bucket path). Emitted as literals (javac constant-folds them) with a
// tagId(...)derivation comment for auditability.slotis a fast-path bitmask bit, not positional storage — co-occurrence is tolerated (the scanis authoritative). Coloring gives co-occurring tags distinct bits (fewer scans); colorability
derives from
required. The whole mask fits onelong.trace_levelsection → its own TagMap layer); the per-spanbasetype holds
parent_id/_dd.integration/_dd.svc_src(core-set but per-span).service/resource.name/error/sampling.priority/…) get reserved ids; thegenerated
id → handlerdispatch table is the on-ramp to retiring theTagInterceptor.Verified:
internal-apimain compiles;KnownTagsTest(property-based resolver round-trip over ~55tags) passes;
OptimizedTagMapDenseForkedTestpasses; spotless clean. Note: literal ids fold, so aconstant reference no longer triggers
<clinit>— registration is viaKnownTags.init().Remaining (why draft): the generated
KnownTags.javais a manual copy insrc/mainright now;wire the task to emit to a committed
src/generated/java+srcDir+ averifyGeneratedfreshnesscheck + format-on-generate, and route the layout reports (
folded-types/tag-assignment) there ascommitted artifacts.
🤖 Generated with Claude Code