Add okhttp autoconfiguration for spring boot 4#5797
Conversation
Instructions and example for changelogPlease add an entry to 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 |
📲 Install BuildsAndroid
|
Performance metrics 🚀
|
| 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 |
|
@sentry review |
|
cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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); |
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit 12cd936. Configure here.


📜 Description
Add autoconfiguration for okhttp
💡 Motivation and Context
Resolves #4898
💚 How did you test it?
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps