Discard envelopes on `4xx` and `5xx` response
:scroll: Description
Envelopes are now discarded on a 4xx or 5xx response instead of retrying them.
- For
4xxit's most likely an SDK (e.g. incorrect serialization) or envelope problem (e.g. too large) where retry does not make sense. - We decided to also not retry on a
5xxresponse in order not to take down Sentry by accumulating lots of envelopes in case of an outage where after restoring functionality Sentry is hit by too many requests.
:bulb: Motivation and Context
Fixes #4921 Fixes #4936
:green_heart: How did you test it?
:pencil: 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
sendDefaultPIIis 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.
:crystal_ball: Next steps
🚨 Detected changes in high risk code 🚨
High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:
- [ ] sentry/src/main/java/io/sentry/transport/AsyncHttpTransport.java
Performance metrics :rocket:
| Plain | With Sentry | Diff | |
|---|---|---|---|
| Startup time | 318.68 ms | 394.94 ms | 76.26 ms |
| Size | 1.58 MiB | 2.13 MiB | 558.75 KiB |
Baseline results on branch: main
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| f634d01652b3f4ddf21398daf541b63620228184 | 359.58 ms | 433.88 ms | 74.30 ms |
| 9fbb1127f2d985a834f669b39d88441f21bdbf8c | 401.87 ms | 515.87 ms | 114.00 ms |
| d5a29b63ebae46648f71d2061ff84809a0259c18 | 298.62 ms | 391.78 ms | 93.16 ms |
| bbc35bb115c7c17672d4bef1fbec1a122307bbae | 298.53 ms | 372.17 ms | 73.64 ms |
| b3d8889a0ebafa274fe83e8d97834c5be07c5361 | 420.46 ms | 453.71 ms | 33.26 ms |
| a5ab36fc4bf89f972d9dbe8e6233fd651c079e5a | 320.47 ms | 389.77 ms | 69.30 ms |
| ee747ae50ffec79f1ea20d100ea98e8520ab4ed4 | 405.43 ms | 485.70 ms | 80.28 ms |
| 951caf72e161c0854233d20019ce53b1f0ca9f15 | 323.66 ms | 392.82 ms | 69.16 ms |
| b6702b024bee02602949a16ed586081ef16d5806 | 395.86 ms | 409.98 ms | 14.12 ms |
| 27d7cf8ded2a2dccde9ce035bb92f27c2dc81caf | 369.82 ms | 422.62 ms | 52.80 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| f634d01652b3f4ddf21398daf541b63620228184 | 1.58 MiB | 2.10 MiB | 533.40 KiB |
| 9fbb1127f2d985a834f669b39d88441f21bdbf8c | 1.58 MiB | 2.11 MiB | 539.18 KiB |
| d5a29b63ebae46648f71d2061ff84809a0259c18 | 1.58 MiB | 2.12 MiB | 549.37 KiB |
| bbc35bb115c7c17672d4bef1fbec1a122307bbae | 1.58 MiB | 2.12 MiB | 553.01 KiB |
| b3d8889a0ebafa274fe83e8d97834c5be07c5361 | 1.58 MiB | 2.10 MiB | 535.07 KiB |
| a5ab36fc4bf89f972d9dbe8e6233fd651c079e5a | 1.58 MiB | 2.12 MiB | 555.26 KiB |
| ee747ae50ffec79f1ea20d100ea98e8520ab4ed4 | 1.58 MiB | 2.10 MiB | 530.95 KiB |
| 951caf72e161c0854233d20019ce53b1f0ca9f15 | 1.58 MiB | 2.13 MiB | 558.77 KiB |
| b6702b024bee02602949a16ed586081ef16d5806 | 1.58 MiB | 2.12 MiB | 551.79 KiB |
| 27d7cf8ded2a2dccde9ce035bb92f27c2dc81caf | 1.58 MiB | 2.12 MiB | 549.42 KiB |
Previous results on branch: feat/do-not-retry-4xx-and-5xx
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 3819f1978b35aebc915ed6b10ebb96b7d7b3b530 | 321.95 ms | 383.09 ms | 61.14 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 3819f1978b35aebc915ed6b10ebb96b7d7b3b530 | 1.58 MiB | 2.13 MiB | 558.75 KiB |
🚨 Detected changes in high risk code 🚨
High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:
- [ ] sentry/src/main/java/io/sentry/transport/AsyncHttpTransport.java
🚨 Detected changes in high risk code 🚨
High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:
- [ ] sentry/src/main/java/io/sentry/transport/AsyncHttpTransport.java
🚨 Detected changes in high risk code 🚨
High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:
- [ ] sentry/src/main/java/io/sentry/transport/AsyncHttpTransport.java