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

Prevent NoOpHub from creating heavy SentryOptions objects. #1272

Merged
merged 4 commits into from
Feb 22, 2021

Conversation

maciejwalkowiak
Copy link
Contributor

📜 Description

Prevent NoOpHub from creating heavy SentryOptions objects.

💡 Motivation and Context

Fixes #1263

💚 How did you test it?

📝 Checklist

  • I reviewed the submitted code
  • I added tests to verify the changes
  • I updated the docs if needed
  • No breaking changes

* @param empty if options should be empty.
*/
private SentryOptions(final boolean empty) {
if (!empty) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the heaviest objects are inited. directly during the field declaration, maybe we should move all of them here in the ctor, so we can really do a cheap ctor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The most heavy part is MainEventProcessor with HostnameCache that spins up a thread and SentryExecutorService. The rest is mainly no-op, except the serializer but i am not sure if it makes sense to complicate it any further.

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds good

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.

NoOpHub.getOptions() should return a cached instance of SentryOptions instead of creating a new instance
2 participants