fix(spring): [Cache Tracing 11] Skip cache span data when child span is NoOp#5192
Draft
adinauer wants to merge 1 commit intofeat/cache-tracing-spring-boot-2from
Draft
fix(spring): [Cache Tracing 11] Skip cache span data when child span is NoOp#5192adinauer wants to merge 1 commit intofeat/cache-tracing-spring-boot-2from
adinauer wants to merge 1 commit intofeat/cache-tracing-spring-boot-2from
Conversation
Add span.isNoOp() check after startChild() in all three Spring SentryCacheWrapper variants, matching the existing pattern in SentryJCacheWrapper. This avoids setting span data on noop spans when sampling drops the span. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 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. |
Sentry Build Distribution
|
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.isNoOp()check afterstartChild()in thestartSpan()helper method of all three SpringSentryCacheWrappervariants (sentry-spring,sentry-spring-7,sentry-spring-jakarta). This matches the existing pattern inSentryJCacheWrapper, which already had this check.Without this fix, when sampling drops a span, the wrapper still sets span data (
cache.key, etc.) on the noop span unnecessarily.💡 Motivation and Context
The JCache wrapper (
SentryJCacheWrapper) correctly returnsnullwhen the child span is a NoOp (e.g. due to sampling), skipping all span data decoration. The three Spring cache wrappers were missing this check, creating an inconsistency and doing unnecessary work on noop spans.💚 How did you test it?
Code review — the change is minimal and mirrors the existing JCache pattern exactly.
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
None — this is a small consistency fix.
#skip-changelog