Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring Boot cache integration POC #3457

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

adinauer
Copy link
Member

@adinauer adinauer commented Jun 4, 2024

📜 Description

💡 Motivation and Context

💚 How did you test it?

📝 Checklist

  • I reviewed the submitted code.
  • 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.
  • 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

Copy link
Contributor

github-actions bot commented Jun 4, 2024

Fails
🚫 Please consider adding a changelog entry for the next release.
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

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

- Spring Boot cache integration POC ([#3457](https://github.com/getsentry/sentry-java/pull/3457))

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

Generated by 🚫 dangerJS against beab210

Copy link
Contributor

github-actions bot commented Jun 4, 2024

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 421.56 ms 499.07 ms 77.51 ms
Size 1.70 MiB 2.28 MiB 592.12 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
d6d2b2e 392.55 ms 467.50 ms 74.95 ms
c7e2fbc 393.98 ms 478.24 ms 84.27 ms
4e260b3 388.40 ms 468.98 ms 80.58 ms
28c9a83 366.20 ms 433.88 ms 67.67 ms
baaf637 418.39 ms 496.86 ms 78.47 ms
283d83e 416.81 ms 497.22 ms 80.41 ms
283d83e 348.44 ms 392.06 ms 43.62 ms
0bf143e 368.35 ms 437.47 ms 69.12 ms
86f0096 368.63 ms 446.92 ms 78.29 ms
619c9b9 428.23 ms 514.66 ms 86.43 ms

App size

Revision Plain With Sentry Diff
d6d2b2e 1.72 MiB 2.27 MiB 555.05 KiB
c7e2fbc 1.72 MiB 2.29 MiB 576.40 KiB
4e260b3 1.72 MiB 2.27 MiB 554.95 KiB
28c9a83 1.70 MiB 2.28 MiB 592.00 KiB
baaf637 1.72 MiB 2.27 MiB 558.42 KiB
283d83e 1.72 MiB 2.29 MiB 577.69 KiB
283d83e 1.72 MiB 2.29 MiB 577.69 KiB
0bf143e 1.72 MiB 2.29 MiB 576.50 KiB
86f0096 1.72 MiB 2.29 MiB 576.50 KiB
619c9b9 1.70 MiB 2.28 MiB 592.12 KiB

}

@Cacheable(value = "people", key = "{ #root.methodName, #person.firstName, #person.lastName }")
Copy link
Member Author

@adinauer adinauer Jun 5, 2024

Choose a reason for hiding this comment

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

If no key config is defined, @Cacheable will use the object itself as key, so beware of sending PII to Sentry.

import java.util.concurrent.Callable;
import org.springframework.cache.Cache;

public class SentryCacheWrapper implements Cache {
Copy link
Member Author

Choose a reason for hiding this comment

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

We've just implemented some methods here to showcase how this works. The rest still needs to be implemented.

Collections.singletonMap(SENTRY_SLUG_KEY, "monitor_slug_simple_trigger"));
return trigger;
public CacheManager cacheManager() {
return new SentryCacheManagerWrapper(new ConcurrentMapCacheManager("people"));
Copy link
Member Author

Choose a reason for hiding this comment

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

Could also do this in a bean post processor to support the default bean. We'll consider the bean post processor approach but might end up integrating this into our POTel offering.

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