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

Propagate modifications of OkHttp requests to the affected spans / breadcrumbs #4238

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

markushi
Copy link
Member

@markushi markushi commented Mar 6, 2025

📜 Description

Makes span/breadcrumb data mutable, so we can update it whenever the underlying http request changes.

Unfortunately the okhttp EventListener always gets the original request in most of it's callbacks, even though interceptors have changed the request already. Only when a response is received (e.g. responseHeadersStart()) the response.request.call would contain the actual request, which probably isn't always called due to caching / errors, etc..

Thus we need to wire the update logic into our interceptor instead - and assume it's running last in the chain.

💡 Motivation and Context

Fixes #3610

💚 How did you test it?

📝 Checklist

  • 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

@markushi markushi changed the title Update okhttp span/breadcrumbs in case interceptors change the request Propagate modifications to OkHttp requests to the affected spans / breadcrumbs Mar 6, 2025
Copy link
Contributor

github-actions bot commented Mar 6, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 478.36 ms 529.26 ms 50.90 ms
Size 1.58 MiB 2.21 MiB 642.09 KiB

Previous results on branch: markushi/fix/missing-okhttp-interceptor-request-update

Startup times

Revision Plain With Sentry Diff
1c77f60 430.78 ms 445.54 ms 14.76 ms

App size

Revision Plain With Sentry Diff
1c77f60 1.58 MiB 2.21 MiB 642.10 KiB

@markushi markushi changed the title Propagate modifications to OkHttp requests to the affected spans / breadcrumbs Propagate modifications of OkHttp requests to the affected spans / breadcrumbs Mar 6, 2025
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.

Changes in url from interceptor chain not represented inside span/breadcrumb
1 participant