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

[QA] Cache parsed Dsn #3796

Merged
merged 5 commits into from
Oct 17, 2024
Merged

[QA] Cache parsed Dsn #3796

merged 5 commits into from
Oct 17, 2024

Conversation

stefanosiano
Copy link
Member

📜 Description

We parse the dsn multiple times in the app lifecycle, and most of the times on the main thread. We can parse it once and cache its result

💡 Motivation and Context

💚 How did you test it?

📝 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

@stefanosiano stefanosiano marked this pull request as ready for review October 16, 2024 09:10
Copy link
Contributor

github-actions bot commented Oct 16, 2024

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 436.98 ms 501.08 ms 64.10 ms
Size 1.70 MiB 2.35 MiB 668.26 KiB

Previous results on branch: fix/cache-parsed-dsn

Startup times

Revision Plain With Sentry Diff
a126274 388.87 ms 427.62 ms 38.75 ms

App size

Revision Plain With Sentry Diff
a126274 1.70 MiB 2.35 MiB 668.43 KiB

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, I left a few comments - please have a look!

sentry/src/main/java/io/sentry/SentryOptions.java Outdated Show resolved Hide resolved
@SuppressWarnings("unused")
final Dsn parsedDsn = new Dsn(dsn);
// This creates the DSN object and performs some checks
options.getParsedDsn();
Copy link
Member

Choose a reason for hiding this comment

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

This is kind-of brittle, as whoever calls getParsedDsn() first, may receives an exception. On the other hand it was like this before, so all good for now 😃

@stefanosiano stefanosiano enabled auto-merge (squash) October 17, 2024 09:30
@stefanosiano stefanosiano merged commit 9182d86 into main Oct 17, 2024
27 checks passed
@stefanosiano stefanosiano deleted the fix/cache-parsed-dsn branch October 17, 2024 09:46
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