Repository navigation
Conversation
…ndSafe / @BackgroundOnly DDCache is cheap (small, bounded probe count) -- safe to call from application threads. SimpleUtf8Cache and GenerationalUtf8Cache trade CPU for allocation savings that only pay off when run on a background thread, so they're confined to the background serializer thread. APMLP-1544 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The prior commit documented the constraint in a Javadoc @link but never applied the annotation itself, so J16's grep-based resolution had nothing to match. APMLP-1544 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Add the Checker contract section (Trigger/Not-a-trigger/Violation/ Compliant/Out-of-scope) that @NoEscape already uses, so the rule is machine-checkable straight from the annotation's own Javadoc without needing J16's prose. Also note that @BackgroundOnly is orthogonal to JSR-305 @threadsafe -- one governs concurrent-caller safety, the other which category of caller is valid at all -- since both now land on the same cache classes. APMLP-1543 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…16 test coverage Adds the declaration-site inheritance-narrowing rule to both annotations' Javadoc and to the performance lens's J16 addendum (now slugged background-only-contract for stable cross-referencing), switches both annotations from SOURCE to CLASS retention so a future bytecode checker (APMLP-1645) can see them, adds llm-validation fixtures covering the interface-hop and inheritance-widening cases, and documents the foreground/background contract in instrumentation_design_guidelines.md. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…lse-positive FixedSizeCache's @ForegroundSafe Javadoc overclaimed: computeIfAbsent's producer and visit()'s consumer are caller-supplied and can be arbitrarily expensive, so the annotation now scopes its guarantee to the cache's own bookkeeping only. J16's interface-propagation hop-1 flagged any interface-typed call site reachable to a @BackgroundOnly implementer C, even when the diff visibly binds the receiver to a different, safe implementation -- guaranteed unreachable. Hop-1 now checks for a visible binding first and only falls back to flag-with-confidence when the receiver's concrete type isn't resolvable from the diff. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
FixedSizeCache's per-method markers were unreachable by the checker at real call sites, since every caller holds a DDCache-typed reference. Move @BackgroundOnly onto DDCache.visit() itself (mirroring the EncodingCache precedent) and drop it from FixedSizeCache.clear(), which wasn't cost-justified at the small capacities real callers use. Also fixes an inverted "narrow"/"widen" phrase in both markers' javadoc (three independent reviewers flagged it) and updates the J16 example in performance.md to match.
2 of 6 tasks
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. |
2 of 6 tasks
Contributor
Author
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
datadog.trace.api.function.ForegroundSafe/.BackgroundOnlyannotations declaring a one-way foreground/background cost contract.@BackgroundOnly/@ForegroundSafetoDDCache,FixedSizeCache,EncodingCache,SimpleUtf8Cache, andGenerationalUtf8Cacheas initial markers.docs/instrumentation_design_guidelines.md.CLASSretention so a future bytecode-level checker (APMLP-1645) can consume the markers.Motivation
Part of APMLP-1513 / APMLP-1645: giving a declared contract to check foreground/background thread-cost assumptions against, rather than relying on ad hoc judgment calls about whether code is cheap enough for a foreground thread.
Notes
dd-apm-sdk-reviewreview-framework branch). The J16 checker-lens rule and.llm-validationfixtures that accompanied that work are dropped from this PR along with the framework dependency; checker enforcement is deferred to APMLP-1645 and, if useful, to the/perf-reviewskill instead../gradlew :internal-api:spotlessJavaCheckpasses.Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueJira ticket: APMLP-1513
🤖 Generated with Claude Code