Automatically downsample transaction when system is under load (backpressure)#3072
Merged
Automatically downsample transaction when system is under load (backpressure)#3072
Conversation
Co-authored-by: Sentry Github Bot <[email protected]> Co-authored-by: Roman Zavarnitsyn <[email protected]>
* reduced timeout of AsyncHttpTransport close to flushTimeoutMillis (default 4s in Android and 15s in Java) to avoid ANRs in Android
* Add deadline timeout for automatic transactions * Update Changelog * Address PR comments * Fix formatting * Add missing test, improve naming * Ensure deadline timeout is only set once
* updated minimum Android SDK version to 19 * removed few workarounds for version < 19
Co-authored-by: Roman Zavarnitsyn <[email protected]> Co-authored-by: Sentry Github Bot <[email protected]>
adinauer
commented
Dec 1, 2023
sentry/src/main/java/io/sentry/transport/AsyncHttpTransport.java
Outdated
Show resolved
Hide resolved
Contributor
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| d6d2b2e | 392.55 ms | 467.50 ms | 74.95 ms |
| 99a51e2 | 405.11 ms | 479.65 ms | 74.54 ms |
| 0bd723b | 375.20 ms | 452.41 ms | 77.20 ms |
| c7e2fbc | 377.85 ms | 426.35 ms | 48.50 ms |
| b172d4e | 412.60 ms | 492.68 ms | 80.08 ms |
| 4e29063 | 364.08 ms | 445.51 ms | 81.43 ms |
| bc4be3b | 360.40 ms | 435.04 ms | 74.64 ms |
| 93a76ca | 397.30 ms | 455.16 ms | 57.87 ms |
| 8fd337b | 349.16 ms | 459.22 ms | 110.06 ms |
| 93a76ca | 377.41 ms | 448.22 ms | 70.81 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| d6d2b2e | 1.72 MiB | 2.27 MiB | 555.05 KiB |
| 99a51e2 | 1.72 MiB | 2.29 MiB | 576.34 KiB |
| 0bd723b | 1.72 MiB | 2.29 MiB | 578.09 KiB |
| c7e2fbc | 1.72 MiB | 2.29 MiB | 576.40 KiB |
| b172d4e | 1.72 MiB | 2.29 MiB | 578.09 KiB |
| 4e29063 | 1.72 MiB | 2.29 MiB | 578.38 KiB |
| bc4be3b | 1.72 MiB | 2.29 MiB | 576.53 KiB |
| 93a76ca | 1.72 MiB | 2.29 MiB | 576.75 KiB |
| 8fd337b | 1.72 MiB | 2.27 MiB | 555.00 KiB |
| 93a76ca | 1.72 MiB | 2.29 MiB | 576.75 KiB |
Previous results on branch: feat/backpressure
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 8d081e4 | 446.34 ms | 535.84 ms | 89.50 ms |
| 9f06b6e | 361.10 ms | 430.00 ms | 68.90 ms |
| 95f8fd0 | 415.82 ms | 470.54 ms | 54.72 ms |
| 3b8dee7 | 436.04 ms | 526.52 ms | 90.48 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 8d081e4 | 1.72 MiB | 2.27 MiB | 556.60 KiB |
| 9f06b6e | 1.72 MiB | 2.27 MiB | 556.27 KiB |
| 95f8fd0 | 1.72 MiB | 2.27 MiB | 556.38 KiB |
| 3b8dee7 | 1.72 MiB | 2.27 MiB | 556.30 KiB |
Member
|
one thing you're missing - a new client report ( sentry-java/sentry/src/main/java/io/sentry/Hub.java Lines 668 to 670 in 1ad36f1 |
sl0thentr0py
reviewed
Dec 1, 2023
sl0thentr0py
reviewed
Dec 1, 2023
sentry/src/main/java/io/sentry/transport/QueuedThreadPoolExecutor.java
Outdated
Show resolved
Hide resolved
lbloder
reviewed
Dec 12, 2023
Collaborator
lbloder
left a comment
There was a problem hiding this comment.
Left comments on some minor things. Looks good otherwise 👍
Do we want to add the configuration also to the ExternalOptions to make this available to other integrations too?
As far as I can see, enabling backpressureHandling is currently only possible via Spring and the SentryProperties or by supplying SentryOptions in code, correct?
sentry/src/main/java/io/sentry/backpressure/BackpressureMonitor.java
Outdated
Show resolved
Hide resolved
sentry/src/main/java/io/sentry/transport/AsyncHttpTransport.java
Outdated
Show resolved
Hide resolved
…check is run against it
lbloder
approved these changes
Dec 13, 2023
Collaborator
lbloder
left a comment
There was a problem hiding this comment.
LGTM, one minor nitpick :)
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
Automatically downsample transaction when system is under load by checking:
This check is performed every 10 seconds. With each negative health check we halve
tracesSampleRateup to 10 times, meaning the originaltracesSampleRateis multiplied by 1, 1/2, 1/4, ... up to 1/1024 (~ 0.001%). Any positive health check resets to the originaltracesSampleRateset inSentryOptions.Also see python PRs for reference.
💡 Motivation and Context
Closes #2829
💚 How did you test it?
Unit tests, manually using Spring Boot sample.
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps