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

Fix duplicated http spans #3526

Merged
merged 4 commits into from
Jun 27, 2024
Merged

Fix duplicated http spans #3526

merged 4 commits into from
Jun 27, 2024

Conversation

stefanosiano
Copy link
Member

📜 Description

SentryOkHttpEventListener now checks if an existing io.sentry.android.SentryOkHttpEventListener is attached and skips it

💡 Motivation and Context

Customers reported duplicated http spans, that was happening due to our Gradle plugin auto instrument using the old version of the SentryOkHttpEventListener from the sentry-android-okhttp artifact.
That was delegating to the listener from sentry-okhttp, and when being instrumented multiple times, it was creating multiple http spans, overwriting the parent http.client span in the listener, causing the duplicated spans to never finish, due to their reference being lost.

💚 How did you test it?

Unit test

📝 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

….SentryOkHttpEventListener is attached and skips it
@stefanosiano stefanosiano changed the title SentryOkHttpEventListener now checks if an existing io.sentry.android… Fix duplicated http spans Jun 27, 2024
@stefanosiano stefanosiano marked this pull request as ready for review June 27, 2024 13:29
Copy link
Contributor

github-actions bot commented Jun 27, 2024

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 395.43 ms 477.09 ms 81.66 ms
Size 1.70 MiB 2.28 MiB 593.07 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
baaf637 462.32 ms 579.22 ms 116.90 ms
28c9a83 416.98 ms 479.90 ms 62.92 ms
201048a 418.62 ms 481.67 ms 63.05 ms
7ab32b6 373.62 ms 480.61 ms 106.99 ms
b172d4e 352.92 ms 446.50 ms 93.58 ms
3d8bd2b 364.76 ms 469.98 ms 105.22 ms
1e05e43 411.00 ms 467.29 ms 56.29 ms
c554ca2 383.78 ms 449.84 ms 66.06 ms
0bd723b 375.20 ms 452.41 ms 77.20 ms
99a51e2 405.11 ms 479.65 ms 74.54 ms

App size

Revision Plain With Sentry Diff
baaf637 1.72 MiB 2.27 MiB 558.42 KiB
28c9a83 1.70 MiB 2.28 MiB 592.00 KiB
201048a 1.70 MiB 2.28 MiB 592.32 KiB
7ab32b6 1.70 MiB 2.27 MiB 584.63 KiB
b172d4e 1.72 MiB 2.29 MiB 578.09 KiB
3d8bd2b 1.72 MiB 2.29 MiB 577.53 KiB
1e05e43 1.70 MiB 2.28 MiB 590.89 KiB
c554ca2 1.70 MiB 2.27 MiB 582.25 KiB
0bd723b 1.72 MiB 2.29 MiB 578.09 KiB
99a51e2 1.72 MiB 2.29 MiB 576.34 KiB

Previous results on branch: fix/duplicated-okhttp-spans

Startup times

Revision Plain With Sentry Diff
bb4e7b5 429.15 ms 474.81 ms 45.67 ms

App size

Revision Plain With Sentry Diff
bb4e7b5 1.70 MiB 2.28 MiB 593.07 KiB

Copy link
Member

@adinauer adinauer left a comment

Choose a reason for hiding this comment

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

LGTM

  • some questions
  • a comment explaining why the fix is necessary could be nice, made a suggestion.

@stefanosiano
Copy link
Member Author

Just pointing out this will be less relevant when getsentry/sentry-android-gradle-plugin#724 will be released

@stefanosiano stefanosiano merged commit 2364670 into main Jun 27, 2024
24 checks passed
@stefanosiano stefanosiano deleted the fix/duplicated-okhttp-spans branch June 27, 2024 15:30
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.

3 participants