Repository navigation
Conversation
🟢 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. |
2df973a to
0a4ba91
Compare
0a4ba91 to
1877eec
Compare
1877eec to
162124d
Compare
fdc5ce3 to
893723f
Compare
aab8fc9 to
d2ee7e5
Compare
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
There was a problem hiding this comment.
In DDSpanContext.java at line 827, removing the kind-first prepass causes http.url to be processed while span.kind is unset, so the URL interceptor applies server resource mappings instead of client mappings; the kind-first preseed must be restored before fallback tag iteration to prevent incorrect resource names.
🤖 Bits Code Review · Commit b13ce2c
There was a problem hiding this comment.
More details
The PR adds bulk prototype-tag seeding and a prototype-based single-span builder, with no findings remaining open. The update fixes client URL normalization by seeding span.kind before fallback interception, preserves an existing kind, and adds regression coverage for both stores.
🤖 Bits Code Review · Commit b3a099a
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b13ce2c85e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
bric3
left a comment
There was a problem hiding this comment.
Could we keep the singleSpanBuilder(SpanPrototype, ...) overload here and move bulk seeding to a follow-up? The posted measurements put the bulk path within noise for today's prototypes. When bulk seeding is eligible, the server decorator still falls back on local-root spans because both the span and the prototype carry language. That takes the tag lock twice, and the retrofit benchmark omits this overlap.
For the follow-up, I'd benchmark with the production decorator prototypes and add a test that verifies custom TagInterceptor behavior is preserved.
| SeedPlan plan = | ||
| new SeedPlan( | ||
| tagInterceptor, | ||
| tags.knownStore().supportsBulkSeed() && tagInterceptor.canSeedInBulk(tags), |
There was a problem hiding this comment.
issue: CoreTracerBuilder.tagInterceptor(...) accepts a custom interceptor. Before this PR, both prototype paths called its interceptTag override for component. With dense tags and disjoint masks, the bulk copy now stores that value directly, even if the override would have consumed it. The construction fallback also skips the override for a nonstandard span.kind, including with dense tags off. How about limiting bulk seeding to the stock interceptor and keeping the previous fallback for custom interceptors?
There was a problem hiding this comment.
Bulk seeding is out of this PR now (see the review reply), so this moves with it to the follow-up on dougqh/prototype-bulk-seed. I'll address it there, either by limiting bulk seeding to the stock interceptor or by keeping the previous path for custom ones. It'll come with a test that a custom interceptTag override still sees component and a nonstandard span.kind. In this PR, both go through the interceptor as on master.
| ctx.routePut(tagEntry); | ||
| } | ||
| }); | ||
| if (!seedKnownInBulk(plan, tags)) { |
There was a problem hiding this comment.
suggestion: A local-root server span already has language from Config.getLocalRootSpanTags(). ServerDecorator adds it to its prototype too, so an eligible bulk attempt acquires knownTags, rejects the overlap, and setAllTags acquires the monitor again. webServerSpanRetrofit omits language from its prototype, so it misses this fallback. Could we defer bulk seeding until a before/after benchmark covers that path? If we keep it, can the bulk attempt and fallback share the same synchronized block?
There was a problem hiding this comment.
Bulk seeding is out of this PR now (see the review reply), so this moves with it to the follow-up on dougqh/prototype-bulk-seed. The follow-up's benchmark will use the production decorator prototypes, ServerDecorator's language included, so it covers the local-root fallback. If bulk seeding stays, the attempt and the fallback will share one synchronized block.
| * and the span kind they carry), built on first use. Racy by design: the plan is immutable, so a | ||
| * reader sees null or a complete plan, and two threads building it at once just build it twice. | ||
| */ | ||
| private Object seedPlan; |
There was a problem hiding this comment.
suggestion: seedPlan has one slot for the last interceptor. If two tracers alternate spans from a shared decorator prototype, each switch allocates a new plan, even with dense tags disabled. How about keeping tracer-specific state out of SpanPrototype, given that bulk seeding is within noise for the current prototypes? If we retain a cache, could we test one shared prototype with two interceptor configurations? The current getter/setter and repeat-span tests both pass if the tracer builds a plan for every span.
There was a problem hiding this comment.
Bulk seeding is out of this PR now (see the review reply), so this moves with it to the follow-up on dougqh/prototype-bulk-seed. SpanPrototype gains no tracer-specific state here. If the follow-up keeps a cache, it'll include your test of one shared prototype under two interceptor configurations.
|
|
||
| /** This map's known-tag store. */ | ||
| @Restricted(allowedIn = {"datadog.trace.core"}) | ||
| public IdStore knownStore() { |
There was a problem hiding this comment.
suggestion: knownStore() exposes the mutable store behind SpanPrototype.tags(). IdStore.store and remove bypass the frozen TagMap check and can invalidate the cached kind and plan. How about passing the source TagMap to IdStore.seedAbsent, so the store can read it within the package? That also leaves the new IdStore.forEach overloads package-private. The only new traversal caller outside the package uses HashStore.forEach(T, BiConsumer).
There was a problem hiding this comment.
Bulk seeding is out of this PR now (see the review reply), so this moves with it to the follow-up on dougqh/prototype-bulk-seed. TagMap.knownStore() and the new IdStore.forEach overloads aren't in this PR. Passing the source TagMap to seedAbsent is the shape I'll use there.
| } | ||
|
|
||
| /** Records the tracer core's seed plan for these tags; see {@link #seedPlan()}. */ | ||
| @Restricted(allowedIn = {"datadog.trace.core"}) |
There was a problem hiding this comment.
todo: @Restricted requires an entry for each member in gradle/forbiddenApiFilters/instrumentation.txt. Could we add SpanPrototype#seedPlan(), SpanPrototype#seedPlan(java.lang.Object), and TagMap#knownStore() for whichever accessors remain? The two cache methods use Object, so the existing store-type bans do not cover them.
There was a problem hiding this comment.
Bulk seeding is out of this PR now (see the review reply), so this moves with it to the follow-up on dougqh/prototype-bulk-seed. None of seedPlan(), seedPlan(Object) or knownStore() exists here, and the follow-up will add the instrumentation.txt entries for whatever remains.
| DenseIdStore tombstoned = new DenseIdStore(parent); | ||
| tombstoned.remove(KnownTags.COMPONENT); | ||
| assertFalse(new DenseIdStore(null).seedAbsent(tombstoned), "tombstoned source"); | ||
| } |
There was a problem hiding this comment.
suggestion: Both sources in this test have a parent, so seedAbsent returns before it can check for a tombstone. DenseIdStore.removeLocal only creates a tombstone for an inherited value, whose bit is already in inheritedMask. How about testing a target with an inherited tag and asserting that a rejected bulk seed leaves the target untouched? That would exercise the target-side check.
There was a problem hiding this comment.
Bulk seeding is out of this PR now (see the review reply), so this moves with it to the follow-up on dougqh/prototype-bulk-seed. The follow-up will test a target with an inherited tag and assert that a rejected bulk seed leaves it untouched.
| } | ||
|
|
||
| @Test | ||
| void aPrototypeCachesTheSizingHintForItsOwnOperationNameOnly() { |
There was a problem hiding this comment.
chore: SpanPrototypeSizingHintForkedTest already checks the hint for the prototype's own operation, the equivalent UTF8BytesString, a different operation, and separate entry and child lanes. Could we drop this duplicate sizing test from the construction suite?
There was a problem hiding this comment.
Dropped: SpanPrototypeConstructionDenseForkedTest isn't in this PR any more, and SpanPrototypeSizingHintForkedTest covers the hints.
| } | ||
|
|
||
| /** | ||
| * Like {@link #buildSpan(SpanPrototype, CharSequence)}, for one span only: the thread's reusable |
There was a problem hiding this comment.
nitpick: singleSpanBuilder(String, CharSequence) reuses a builder when SPAN_BUILDER_REUSE_ENABLED is true. Could we qualify the Javadoc here so it also describes the configuration that creates a fresh builder?
There was a problem hiding this comment.
Done in 4be8962: the Javadoc now covers both reuse enabled (the default) and disabled.
| public void webServerSpanRetrofit() { | ||
| AgentSpan span = tracer.startSpan(INSTRUMENTATION_NAME, SERVER_OPERATION_NAME); | ||
| span.applyOverwriting(webProto); | ||
| span.setTag(Tags.HTTP_METHOD, HTTP_METHOD_VALUE); |
There was a problem hiding this comment.
nitpick: Could we static-import the tag constants repeated in the new benchmark methods? That follows the repository's import convention and keeps the tag sets easier to scan.
There was a problem hiding this comment.
Done in 4be8962: SpanCreationBenchmark static-imports its Tags constants throughout, not only in the new arm, so the file stays consistent.
b3a099a to
91d90ce
Compare
There was a problem hiding this comment.
Prototype seeding can bypass custom TagInterceptor overrides, changing tag consumption or rewriting. Nonstandard span kinds also bypass custom interception in the construction fallback with dense storage disabled.
🤖 Bits Code Review · Commit 91d90ce
| SeedPlan plan = | ||
| new SeedPlan( | ||
| tagInterceptor, | ||
| tags.knownStore().supportsBulkSeed() && tagInterceptor.canSeedInBulk(tags), |
There was a problem hiding this comment.
Preserve custom interceptor overrides during prototype seeding
A custom interceptor supplied through CoreTracerBuilder.tagInterceptor can override interceptTag(DDSpanContext, EntryReader) to consume or rewrite component. With dense storage and disjoint masks, this eligibility check permits copying component directly, bypassing that override during construction and applyOverwriting. The construction fallback also directly inserts nonstandard span.kind values that previously reached the override, even with dense storage disabled. Restrict bulk seeding to the stock interceptor and preserve interception of nonstandard kinds in the fallback; both paths need correction.
React: 👍 useful · 👎 wrong · 😕 unclear · 👀 right, but not acting on it
What each reaction means
- 👍 Useful: correct, and you're fixing it or will.
- 👎 Wrong: the finding is incorrect, for example the bug can't happen or the code was misread.
- 😕 Unclear: you can't tell what it means or why it matters.
- 👀 Right, not acting: correct, but intended, out of scope for this PR, a known risk, or too minor.
🤖 Bits Code Review · Open Bits AI session
Seeds the thread's reusable builder from a prototype, like buildSpan(prototype), for a span that's built once. With builder reuse disabled it builds a fresh multi-span builder. The prototype's tags are seeded as before, through the interceptor, with a standard span.kind first. Bulk seeding moves to a follow-up (branch dougqh/prototype-bulk-seed): it measured within noise for today's prototypes, and it needs a custom TagInterceptor test and production decorator prototypes in its benchmark first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
91d90ce to
4be8962
Compare
|
@bric3 Split as you suggested. This PR now only adds |
There was a problem hiding this comment.
More details
The prototype overload uses the existing builder initialization and reset path, which clears prototype state before reuse. Earlier bulk-seeding concerns do not apply to the specified diff.
🤖 Bits Code Review · Commit 4be8962
What Does This Do
Adds
singleSpanBuilder(SpanPrototype, CharSequence), so the prototype entry points mirror the plain ones (startSpan,buildSpan,singleSpanBuilder).CoreTracer: with span builder reuse enabled (the default), the thread's reusable builder carries the prototype and drops it when reset for the next span. With reuse disabled, it builds a fresh multi-span builder, assingleSpanBuilder(String, CharSequence)does. Both prototype builder entry points share oneseedFromstep that sets the prototype and span type.AgentTracer.TracerAPI: a default method that seeds identity only (instrumentation and operation name), likebuildSpan(SpanPrototype, …)'s default.span.kindfirst.Motivation
Decorators building one span from a prototype should get the same reusable single-span builder that
singleSpanBuilder(String, CharSequence)gives name-based callers.Additional Notes
ServerDecorator's prototype carrylanguage, so the tag lock is taken twice. And it needs more care around customTagInterceptors. It's on branchdougqh/prototype-bulk-seedfor a follow-up, which will benchmark with the production decorator prototypes and test that custom interceptor behavior is preserved.SpanPrototypeConstructionTestcovers the new overload (seeding, and a reused builder dropping the prototype), construction, overwrite and custom-tag cases.SpanPrototypeKindOrderForkedTestchecks that interceptors readingspan.kind, such ashttp.url's client or server path mappings, see the prototype's kind whatever order its tags were added in.…DenseForkedTestrepeats it with the dense store, which walks tags in slot order.SpanCreationBenchmark.jdbcClientSpanViaPrototypeSingleSpanBuildermeasures the new entry point next to the other jdbc prototype arms. The file now static-imports itsTagsconstants.🤖 Generated with Claude Code