Skip to content

feat(spring): [Cache Tracing 10] Port cache tracing to Spring Boot 2 + samples#5191

Draft
adinauer wants to merge 3 commits intofeat/cache-tracing-spring-boot-3from
feat/cache-tracing-spring-boot-2
Draft

feat(spring): [Cache Tracing 10] Port cache tracing to Spring Boot 2 + samples#5191
adinauer wants to merge 3 commits intofeat/cache-tracing-spring-boot-3from
feat/cache-tracing-spring-boot-2

Conversation

@adinauer
Copy link
Member

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
  • This PR — Port cache tracing to Spring Boot 2 + samples

📜 Description

Port cache tracing classes from sentry-spring-jakarta to sentry-spring (Spring Boot 2 / Spring Framework 5), including:

  • SentryCacheWrapper, SentryCacheManagerWrapper, SentryCacheBeanPostProcessor in io.sentry.spring.cache
  • Auto-configuration wiring in sentry-spring-boot's SentryAutoConfiguration
  • Full unit test coverage (13 tests)
  • retrieve() methods omitted — Spring 5 does not have them (added in Spring 6.1)

Also adds cache tracing sample and e2e tests to sentry-samples-spring-boot:

  • CacheController, TodoService with @Cacheable/@CachePut/@CacheEvict
  • Caffeine cache provider config
  • CacheSystemTest e2e tests

💡 Motivation and Context

Spring Boot 2 is still widely used in production. Without this port, the majority of Spring users would not have access to cache tracing instrumentation.

💚 How did you test it?

  • Unit tests: ./gradlew :sentry-spring:test --tests="*cache*" — all 13 pass
  • Compilation: ./gradlew :sentry-spring:compileJava :sentry-spring-boot:compileJava :sentry-samples:sentry-samples-spring-boot:compileJava :sentry-samples:sentry-samples-spring-boot:compileTestKotlin
  • API dump regenerated with ./gradlew apiDump

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

None — this completes the Spring Boot 2 port. All three Spring Boot versions (2, 3, 4) now have cache tracing support.

⚠️ Merge this PR using a merge commit (not squash). Only the collection branch is squash-merged into main.

adinauer and others added 2 commits March 13, 2026 11:00
Port cache tracing instrumentation from sentry-spring-jakarta to
sentry-spring for Spring Boot 2 users. Adds SentryCacheWrapper,
SentryCacheManagerWrapper, and SentryCacheBeanPostProcessor in the
io.sentry.spring.cache package. Wires auto-configuration in
sentry-spring-boot via sentry.enable-cache-tracing=true property.

The retrieve() methods are omitted since Spring 5 does not have them
(they were added in Spring 6.1).

Co-Authored-By: Claude <noreply@anthropic.com>
Add CacheController, TodoService with @Cacheable/@CachePut/@CacheEvict
annotations, and CacheSystemTest e2e tests to the sentry-samples-spring-boot
sample. Enables cache tracing with Caffeine as the cache provider.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions
Copy link
Contributor

github-actions bot commented Mar 13, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 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 🐛

  • Remove the dependency on protobuf-lite for tombstones by supervacuus in #5157

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 13, 2026

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 7fa53f7

@sentry
Copy link

sentry bot commented Mar 13, 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

@github-actions
Copy link
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 312.46 ms 388.79 ms 76.33 ms
Size 0 B 0 B 0 B

Baseline results on branch: feat/cache-tracing-spring-boot-3

Startup times

Revision Plain With Sentry Diff
2195d21 312.89 ms 370.83 ms 57.94 ms

App size

Revision Plain With Sentry Diff
2195d21 0 B 0 B 0 B

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