Skip to content

Add okhttp autoconfiguration for spring boot 4#5797

Draft
lbloder wants to merge 1 commit into
mainfrom
feat/okhttp-autoconfiguration-boot-4
Draft

Add okhttp autoconfiguration for spring boot 4#5797
lbloder wants to merge 1 commit into
mainfrom
feat/okhttp-autoconfiguration-boot-4

Conversation

@lbloder

@lbloder lbloder commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

📜 Description

Add autoconfiguration for okhttp

💡 Motivation and Context

Resolves #4898

💚 How did you test it?

📝 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.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

@github-actions

Copy link
Copy Markdown
Contributor
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

### Features

- Add okhttp autoconfiguration for spring boot 4 ([#5797](https://github.com/getsentry/sentry-java/pull/5797))

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 12cd936

@sentry

sentry Bot commented Jul 21, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.49.0 (1) release

⚙️ sentry-android Build Distribution Settings

@github-actions

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 339.40 ms 410.78 ms 71.37 ms
Size 0 B 0 B 0 B

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
5b1a06b 352.27 ms 413.70 ms 61.43 ms
2124a46 319.19 ms 415.04 ms 95.85 ms
ad8da22 314.52 ms 352.47 ms 37.95 ms
d15471f 304.55 ms 408.43 ms 103.87 ms
0ee65e9 317.37 ms 366.50 ms 49.13 ms
2195398 351.77 ms 433.22 ms 81.45 ms
ee747ae 358.21 ms 389.41 ms 31.20 ms
abfcc92 309.54 ms 380.32 ms 70.78 ms
8558cac 306.16 ms 355.24 ms 49.09 ms
d15471f 310.26 ms 377.04 ms 66.78 ms

App size

Revision Plain With Sentry Diff
5b1a06b 0 B 0 B 0 B
2124a46 1.58 MiB 2.12 MiB 551.51 KiB
ad8da22 1.58 MiB 2.29 MiB 719.83 KiB
d15471f 1.58 MiB 2.13 MiB 559.54 KiB
0ee65e9 0 B 0 B 0 B
2195398 0 B 0 B 0 B
ee747ae 1.58 MiB 2.10 MiB 530.95 KiB
abfcc92 1.58 MiB 2.13 MiB 557.31 KiB
8558cac 0 B 0 B 0 B
d15471f 1.58 MiB 2.13 MiB 559.54 KiB

@lbloder

lbloder commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator Author

@sentry review

@lbloder

lbloder commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator Author

cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 12cd936. Configure here.


final boolean addInterceptor = !hasSentryInterceptor(client);
final boolean wrapEventListener =
!(client.eventListenerFactory() instanceof SentryEventListenerFactory);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Existing event listener not detected

Medium Severity

wrapEventListener only skips when the factory is the private SentryEventListenerFactory, so clients already configured with SentryOkHttpEventListener via OkHttp’s .eventListener() (the documented manual setup) still get rebuilt and nested. Nested listeners are partly mitigated inside SentryOkHttpEventListener, but the skip path is incomplete for already-instrumented beans.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 12cd936. Configure here.

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.

Auto configure OkHttp in Spring Boot

1 participant