Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid multiple breadcrumbs from OkHttpEventListener #3175

Merged
merged 3 commits into from
Jan 30, 2024

Conversation

stefanosiano
Copy link
Member

📜 Description

increased SentryOkHttpEvent.scheduleFinish timeout 500ms -> 800ms
added a guard to avoid finishing an already finished event

💡 Motivation and Context

If an OkHttp event was finished multiple times, multiple breadcrumbs would been sent.
This was possible when the response of a call was closed (or read) after more than 500ms since it was received, as our timeout automatically closes the call after 500ms.
I increased the timeout to 800ms to make it less likely to happen. And I added a flag to skip closing the event if it was already closed.
Likely relates to getsentry/sentry-android-gradle-plugin#617

💚 How did you test it?

Unit tests

📝 Checklist

  • I reviewed the submitted code.
  • 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.
  • 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

Copy link
Contributor

github-actions bot commented Jan 29, 2024

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 404.70 ms 426.52 ms 21.82 ms
Size 1.70 MiB 2.27 MiB 584.63 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
2465853 422.61 ms 491.20 ms 68.58 ms
4e29063 376.38 ms 390.98 ms 14.60 ms
0bf143e 368.35 ms 437.47 ms 69.12 ms
d6d2b2e 392.55 ms 467.50 ms 74.95 ms
baaf637 418.39 ms 496.86 ms 78.47 ms
4bf95dd 345.96 ms 414.24 ms 68.28 ms
8ff8fd0 432.77 ms 495.18 ms 62.41 ms
c554ca2 364.98 ms 433.64 ms 68.66 ms
2465853 411.39 ms 461.10 ms 49.72 ms
c7e2fbc 372.00 ms 461.71 ms 89.71 ms

App size

Revision Plain With Sentry Diff
2465853 1.70 MiB 2.27 MiB 583.82 KiB
4e29063 1.72 MiB 2.29 MiB 578.38 KiB
0bf143e 1.72 MiB 2.29 MiB 576.50 KiB
d6d2b2e 1.72 MiB 2.27 MiB 555.05 KiB
baaf637 1.72 MiB 2.27 MiB 558.42 KiB
4bf95dd 1.72 MiB 2.29 MiB 576.40 KiB
8ff8fd0 1.72 MiB 2.27 MiB 558.15 KiB
c554ca2 1.70 MiB 2.27 MiB 582.25 KiB
2465853 1.70 MiB 2.27 MiB 583.82 KiB
c7e2fbc 1.72 MiB 2.29 MiB 576.40 KiB

Previous results on branch: fix/okhttp-double-breadcrumbs

Startup times

Revision Plain With Sentry Diff
16de574 373.08 ms 421.80 ms 48.72 ms

App size

Revision Plain With Sentry Diff
16de574 1.70 MiB 2.27 MiB 584.63 KiB

@stefanosiano stefanosiano marked this pull request as ready for review January 29, 2024 17:04
Copy link
Member

@markushi markushi left a comment

Choose a reason for hiding this comment

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

LGTM!

@stefanosiano stefanosiano enabled auto-merge (squash) January 30, 2024 09:16
@stefanosiano stefanosiano merged commit 6ce1197 into main Jan 30, 2024
24 checks passed
@stefanosiano stefanosiano deleted the fix/okhttp-double-breadcrumbs branch January 30, 2024 09:20
This pull request was closed.
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.

2 participants