Skip to content

fix(spring): [Cache Tracing 21] Fix get(key, type) double-call in SentryCacheWrapper#5210

Draft
adinauer wants to merge 1 commit intoref/cache-tracing-rename-constantsfrom
fix/cache-tracing-typed-get-double-call
Draft

fix(spring): [Cache Tracing 21] Fix get(key, type) double-call in SentryCacheWrapper#5210
adinauer wants to merge 1 commit intoref/cache-tracing-rename-constantsfrom
fix/cache-tracing-typed-get-double-call

Conversation

@adinauer
Copy link
Member

@adinauer adinauer commented Mar 18, 2026

PR Stack (Cache Tracing)

  • #5172 — Add SentryCacheWrapper and SentryCacheManagerWrapper
  • #5173 — Add enableCacheTracing option
  • #5174 — Add BeanPostProcessor and auto-configuration
  • #5175 — Add cache tracing e2e sample
  • #5179 — Add SentryJCacheWrapper for JCache (JSR-107)
  • #5182 — Add JCache console sample
  • #5183 — Add cache tracing to all Spring Boot 4 samples
  • #5184 — Add retrieve() overrides for reactive/async cache support
  • #5190 — Port cache tracing to Spring Boot 3 Jakarta + samples
  • #5191 — Port cache tracing to Spring Boot 2 + samples
  • #5192 — Skip cache span data when child span is NoOp
  • #5201 — Add db.operation.name attribute to cache spans
  • #5202 — Instrument putIfAbsent, replace, and getAndReplace
  • #5203 — Fix cache hit detection for typed get and fix jcache docs link
  • #5204 — Use method-specific span operations for cache spans
  • #5205 — Merge startSpan helpers into shared core method
  • #5206 — Move operation attribute to centralized CACHE_OPERATION_KEY constant
  • #5207 — Add cache.write boolean span attribute
  • #5208 — Use comma-joined keys as span description for bulk JCache operations
  • #5209 — Remove _KEY suffix from cache SpanDataConvention constants
  • #5210 — Fix get(key, type) double-call in SentryCacheWrapper
  • #5212 — Fix cache evict system test to match actual span op

Use a single delegate.get(key, type) call instead of calling
delegate.get(key) for hit detection and delegate.get(key, type) for
the actual value. This eliminates doubled cache round trips (e.g. Redis
network calls) and a TOCTOU race where the entry could expire between
the two calls.

The trade-off is that cached null values are now indistinguishable from
cache misses, which is acceptable for observability purposes.
@github-actions
Copy link
Contributor

github-actions bot commented Mar 18, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

Core

  • [Cache Tracing 2] Add enableCacheTracing option by adinauer in #5173
  • [Cache Tracing 2] Add enableCacheTracing option by adinauer in #5163

Spring

  • [Cache Tracing 10] Port cache tracing to Spring Boot 2 + samples by adinauer in #5191
  • [Cache Tracing 1] Add SentryCacheWrapper and SentryCacheManagerWrapper by adinauer in #5172
  • [Cache Tracing 3] Add BeanPostProcessor and auto-configuration by adinauer in #5174
  • [Cache Tracing 3] Add BeanPostProcessor and auto-configuration by adinauer in #5164
  • [Cache Tracing 1] Add SentryCacheWrapper and SentryCacheManagerWrapper by adinauer in #5162
  • [Cache Tracing 1] Add SentryCacheWrapper and SentryCacheManagerWrapper by adinauer in #5137

Other

  • (anr) Profile main thread when ANR and report ANR profiles to Sentry by markushi in #4899
  • (jcache) [Cache Tracing 5] Add SentryJCacheWrapper for JCache (JSR-107) by adinauer in #5179

Bug Fixes 🐛

  • (spring) [Cache Tracing 21] Fix get(key, type) double-call in SentryCacheWrapper by adinauer in #5210
  • Remove the dependency on protobuf-lite for tombstones by supervacuus in #5157

🤖 This preview updates automatically when you update the PR.

@sentry
Copy link

sentry bot commented Mar 18, 2026

Sentry Build Distribution

App Name App ID Version Configuration Install Page
SDK Size io.sentry.tests.size 8.34.1 (1) release Install Build

This was referenced Mar 18, 2026
@adinauer
Copy link
Member Author

@sentry review

@adinauer
Copy link
Member Author

cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@github-actions
Copy link
Contributor

Fails
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

### Fixes

- [Cache Tracing 21] Fix get(key, type) double-call in SentryCacheWrapper ([#5210](https://github.com/getsentry/sentry-java/pull/5210))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description or adding a skip-changelog label.

Generated by 🚫 dangerJS against 83dfbfa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant