Skip to content

ref(jcache): [Cache Tracing 16] Merge startSpan helpers into shared core method#5205

Merged
adinauer merged 2 commits intofeat/cache-tracingfrom
ref/cache-tracing-merge-startspan-helpers
Mar 23, 2026
Merged

ref(jcache): [Cache Tracing 16] Merge startSpan helpers into shared core method#5205
adinauer merged 2 commits intofeat/cache-tracingfrom
ref/cache-tracing-merge-startspan-helpers

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

📜 Description

In SentryJCacheWrapper, the startSpan and startSpanForKeys helpers had duplicated span creation logic. This PR extracts the shared logic into a single core method startSpan(String operationName, String description, List<String> cacheKeys), and turns the existing startSpan(Object key, ...) and startSpanForKeys(Set<?> keys, ...) into thin convenience wrappers that convert their arguments and delegate.

Also includes Spotless formatting fixes for the Spring wrapper startSpan methods from the previous PR.

💡 Motivation and Context

Reduces code duplication in the JCache wrapper's span helper methods.

💚 How did you test it?

  • All SentryJCacheWrapperTest tests pass
  • No behavior change, pure refactor

📝 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

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

#skip-changelog

Replace the separate startSpanForKeys helper with a startSpan(Set, String)
overload, unifying the two span creation methods under the same name.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@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

Copy link
Collaborator

@lbloder lbloder left a comment

Choose a reason for hiding this comment

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

LGTM +:1

}
span.setData(OPERATION_ATTRIBUTE, operationName);
return span;
return startSpan(operationName, keyString, keyString != null ? Arrays.asList(keyString) : null);
Copy link
Collaborator

Choose a reason for hiding this comment

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

(l) Arrays.asList() could potentially be replaced with Collections.singletonList()

Copy link
Collaborator

@lbloder lbloder left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Base automatically changed from ref/cache-tracing-method-specific-ops to feat/cache-tracing March 23, 2026 14:22
@adinauer adinauer marked this pull request as ready for review March 23, 2026 14:24
@adinauer adinauer merged commit 590c86f into feat/cache-tracing Mar 23, 2026
30 of 56 checks passed
@adinauer adinauer deleted the ref/cache-tracing-merge-startspan-helpers branch March 23, 2026 14:24
@github-actions
Copy link
Contributor

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).


This PR will not appear in the changelog.


🤖 This preview updates automatically when you update the PR.

@sentry
Copy link

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

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.

2 participants