feat(spring): [Cache Tracing 13] Instrument putIfAbsent, replace, and getAndReplace#5202
Draft
adinauer wants to merge 1 commit intofeat/cache-tracing-db-operation-namefrom
Draft
Conversation
…e operations Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. This PR will not appear in the changelog. 🤖 This preview updates automatically when you update the PR. |
This was referenced Mar 17, 2026
Draft
Contributor
|
Sentry Build Distribution
|
Member
Author
|
@sentry review |
Member
Author
|
cursor review |
Contributor
Performance metrics 🚀
|
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.
PR Stack (Cache Tracing)
📜 Description
Add span instrumentation to previously-passthrough conditional cache operations:
Spring Cache (all 3 modules):
putIfAbsent(key, value)— now creates acache.putspanJCache:
putIfAbsent(key, value)—cache.putspanreplace(key, oldValue, newValue)—cache.putspan (conditional CAS)replace(key, value)—cache.putspan (replace if present)getAndReplace(key, value)—cache.putspan (atomic get-and-replace)All follow the same error-handling pattern as existing instrumented methods (try/catch/finally with
SpanStatus.INTERNAL_ERROR+setThrowableon exception). Each setsdb.operation.nameto the method name via thestartSpanhelper.💡 Motivation and Context
These operations were previously skipped because they are conditional writes that may be no-ops. However, they still represent meaningful cache interactions that should be visible in the Sentry Caches UI for observability. The
db.operation.nameattribute (added in the previous PR) allows distinguishing them from unconditionalputoperations.💚 How did you test it?
Updated existing passthrough tests to verify span creation, operation, status,
cache.key, anddb.operation.nameattributes. All tests pass across all 4 modules.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
None — completes coverage of all data operations in Spring Cache and JCache wrappers.
#skip-changelog