Skip to content

Conversation

@adinauer
Copy link
Member

@adinauer adinauer commented Dec 3, 2025

📜 Description

Envelopes are now discarded on a 4xx or 5xx response instead of retrying them.

  • For 4xx it'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 5xx response 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.
  • 429 is considered a load-shedding mechanism which might affect lots of customers so we also do not want to retry sending

Dev docs update PR: getsentry/sentry-docs#15727

💡 Motivation and Context

Fixes #4921
Fixes #4936

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

🔮 Next steps

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

🚨 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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 317.94 ms 388.38 ms 70.44 ms
Size 1.58 MiB 2.13 MiB 559.20 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
5b66efd 308.67 ms 363.85 ms 55.18 ms
fc5ccaf 322.49 ms 405.25 ms 82.76 ms
6405ec5 310.88 ms 354.56 ms 43.69 ms
d364ace 382.77 ms 443.21 ms 60.44 ms
bbc35bb 298.53 ms 372.17 ms 73.64 ms
3d205d0 352.15 ms 432.53 ms 80.38 ms
539ca63 313.51 ms 355.43 ms 41.92 ms
dba088c 365.46 ms 366.31 ms 0.85 ms
fc5ccaf 270.49 ms 363.90 ms 93.41 ms
fcec2f2 328.91 ms 387.75 ms 58.84 ms

App size

Revision Plain With Sentry Diff
5b66efd 1.58 MiB 2.13 MiB 559.07 KiB
fc5ccaf 1.58 MiB 2.13 MiB 557.54 KiB
6405ec5 1.58 MiB 2.12 MiB 552.23 KiB
d364ace 1.58 MiB 2.11 MiB 539.75 KiB
bbc35bb 1.58 MiB 2.12 MiB 553.01 KiB
3d205d0 1.58 MiB 2.10 MiB 532.97 KiB
539ca63 1.58 MiB 2.12 MiB 551.41 KiB
dba088c 1.58 MiB 2.13 MiB 558.99 KiB
fc5ccaf 1.58 MiB 2.13 MiB 557.54 KiB
fcec2f2 1.58 MiB 2.12 MiB 551.50 KiB

Previous results on branch: feat/do-not-retry-4xx-and-5xx

Startup times

Revision Plain With Sentry Diff
75ec0f8 318.68 ms 394.94 ms 76.26 ms
3819f19 321.95 ms 383.09 ms 61.14 ms
4e6d8e3 299.81 ms 364.57 ms 64.76 ms

App size

Revision Plain With Sentry Diff
75ec0f8 1.58 MiB 2.13 MiB 558.75 KiB
3819f19 1.58 MiB 2.13 MiB 558.75 KiB
4e6d8e3 1.58 MiB 2.13 MiB 559.20 KiB

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

🚨 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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

🚨 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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

🚨 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

@github-actions
Copy link
Contributor

🚨 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

@github-actions
Copy link
Contributor

🚨 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

@github-actions
Copy link
Contributor

🚨 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

CHANGELOG.md Outdated

- Discard envelopes on `4xx` and `5xx` response ([#4950](https://github.com/getsentry/sentry-java/pull/4950))
- This aims to not overwhelm Sentry after an outage or load shedding (including HTTP 429) where too many events are sent at once
- We also do not have to re-send on a `4xx` since that's likely an SDK (e.g. wrong serialization) or envelope problem (e.g. too large) and sending it again won't change the result
Copy link
Member

Choose a reason for hiding this comment

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

I'd drop this line as the title already makes it clear and this is just some internal reasoning.

Copy link
Member

Choose a reason for hiding this comment

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

To clarify: I only meant the last line ("- We also do not have to re-send ...")

@adinauer
Copy link
Member Author

Just checked relay using Cursor and it should never return HTTP 408 thus the SDK doesn't need special handling for it.

@github-actions
Copy link
Contributor

🚨 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

@adinauer adinauer merged commit 3d5a001 into main Dec 16, 2025
61 of 62 checks passed
@adinauer adinauer deleted the feat/do-not-retry-4xx-and-5xx branch December 16, 2025 13:49
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.

Built-in monitoring & alerting for stuck / unprocessed envelopes fix: Don't retry sending envelopes when getting 4xx or 5xx

3 participants